im following a tutorial on http://hotwired.lycos.com/webmonkey/99/21/index3a_page3.html?tw=programming and inthe 2nd code listing it has
if($id) to check if the variable $id exists, when i try to run this i get a variable undefined error, which means obviously it doesn't exist, and the workaround kinda loses the point in why its there...
Take a look at isset()
Diego
Or
if (!$id) {
do whatever
} else
Yeah, but he gets a warning saying "Undefined variable $id" and he wants to get rid of it, so he'll have to use isset().
is the tutorial on webmonkey abit f00kered then?
could it be the tutorial was written for php3 and im in php4?
anyway, thx, im checkin out isset now 🙂
could you do
if(isset($foo)) { //$foo exists } else { //$foo doesn't exist }
?
Yeah.