Hi,
I have a developed a web based application using PHP, for using the application, user has to get logged in, I have defined the user as a constant value using
define().
Can we make it case-insensitive, as sometimes user types, JIM, jim, Jim, so it gives an error message, as the user does not match.
Well, define() optionally accepts a third boolean argument that determines whether the constant name should be case insensitive. By default, constants are case sensitive, but by passing true to the define() function you can change this behavior. So, if we were to set up our USER constant in this way
Define (“USER”, “JIM”, true);
we could access its value without worrying about case. So
print User;
print usEr;
print USER;
would all be equivalent.
Leave a Reply
You must be logged in to post a comment.