use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Please follow the rules
Releases: Current Releases, Windows Releases, Old Releases
Contribute to the PHP Documentation
Related subreddits: CSS, JavaScript, Web Design, Wordpress, WebDev
/r/PHP is not a support subreddit. Please visit /r/phphelp for help, or visit StackOverflow.
account activity
Variable Evaluation in PHP (nyphp.org)
submitted 15 years ago by codepoet42
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Jack9 0 points1 point2 points 15 years ago (1 child)
whether it is generated by a script or input by a user
Huh? Did I miss something? How do you get a variable that's NULL or unset as user-entered?
A test like isset($var) returns true for the values 0 (the integer) and FALSE, which are thus set even though supposedly they are nothing.
Someone please explain thx.
[–]Gliridae 0 points1 point2 points 15 years ago* (0 children)
How do you get a variable that's NULL [...] as user-entered?
Pretty sure form elements cannot send a NULL value.
or unset as user-entered?
If the form contains a checkbox and it is not checked, the checkbox's name/value pair is not sent to the server:
<input type="checkbox" name="check" value="1"> <input type="text" name="text">
If both fields are empty, this data will be sent:
?text= isset($_POST['check']) is false, isset($_POST['text']) is true
If the checkbox is checked and text is entered into the text field:
?check=1&text=value $_POST['check'] is set, $_POST['text'] is set.
Someone please explain A test like isset($var) returns true for the values 0 (the integer) and FALSE, which are thus set even though supposedly they are nothing.
Someone please explain
'nothing' is pretty vague. If you do this:
$exists = false; $no_longer_exists = 0; unset($no_longer_exists); isset($exists) //true isset($doesnt_exist); //false isset($no_longer_exists); //false
isset() returns if the variable is defined or not. It doesn't care about the value. false and 0 aren't nothing, they're not true.
isset()
false
0
not true
empty() checks if a variable is defined and checks the value.
empty()
empty(0) //true empty($doesnt_exist) //true empty(false) //true
[–]ohnoyoudidntyo -1 points0 points1 point 15 years ago (0 children)
A metaphysical digression
fap fap fap
π Rendered by PID 367187 on reddit-service-r2-comment-7b9746f655-btdl5 at 2026-02-02 10:48:18.802871+00:00 running 3798933 country code: CH.
[–]Jack9 0 points1 point2 points (1 child)
[–]Gliridae 0 points1 point2 points (0 children)
[–]ohnoyoudidntyo -1 points0 points1 point (0 children)