note 96098 added to language.references.pass

From: Date: Mon, 08 Feb 2010 22:13:56 +0000
Subject: note 96098 added to language.references.pass
Groups: php.notes 
Request: Send a blank email to php-notes+get-165766@lists.php.net to get a copy of this message
Watch out that passing an uninitialised variable to a function will create the variable and will NOT give a NOTICE-undefined variable: function ifnull(&$v,$default) { if (isset($v)) return $v; return $default; } $p=array(); $p['apple']=3; echo ifnull($p['apple'],4); -> 3 echo ifnull($p['pear'],5); -> 5 No "undefined index" here. if (isset($p['pear'])) echo "pear is set"; else echo "pear not set"; -> not set if (array_key_exists('pear',$p)) echo "pear exists"; else echo "pear doesn't exist"; -> pear exists! ---- Server IP: 69.147.83.197 Probable Submitter: 86.95.127.95 ---- Manual Page -- http://www.php.net/manual/en/language.references.pass.php Edit -- https://master.php.net/note/edit/96098 Del: integrated -- https://master.php.net/note/delete/96098/integrated Del: useless -- https://master.php.net/note/delete/96098/useless Del: bad code -- https://master.php.net/note/delete/96098/bad+code Del: spam -- https://master.php.net/note/delete/96098/spam Del: non-english -- https://master.php.net/note/delete/96098/non-english Del: in docs -- https://master.php.net/note/delete/96098/in+docs Del: other reasons-- https://master.php.net/note/delete/96098 Reject -- https://master.php.net/note/reject/96098 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#165766) next »