Strtolower when passing a session to a variable, is it legal?
Can this be done?
$author = strtolower($_SESSION['valid_username']);
I want to enter all authors in the table as lower case.
0
Brad
source
to share
2 answers
Yes, this option is as long as it is $_SESSION['valid_username']
set, otherwise you will receive a notification (if your error reporting is set so low).
You can check if it exists with if (isset($_SESSION['valid_username']))
+3
Greg
source
to share
Yes.
$_SESSION['valid_username']
is a session variable that evaluates a string, so passing it as a parameter to the strtolower function is not a problem.
+2
Vincent Ramdhanie
source
to share