note 83623 added to language.types.array

From: Date: Wed, 04 Jun 2008 23:43:53 +0000
Subject: note 83623 added to language.types.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-140131@lists.php.net to get a copy of this message
>fmouse Variable variables can be used with arrays as discussed in the variable variable section. Also, from your code, $somevar can be an array and still work fine. $fum = "somevar"; $$fum = array(); // $somevar is now an array $foo = $$fum; print_r( $foo); // we get an empty array printed print_r() doesn't just print arrays, it prints any variable type. If you pass it a variable, that hasn't been defined yet, it won't know how to print it. You would get this same results by passing any undefined variable such as: print_r( $bar ); // PHP Notice: undefined variable ...$bar ---- Server IP: 208.69.120.35 Probable Submitter: 98.199.103.141 ---- Manual Page -- http://www.php.net/manual/en/language.types.array.php Edit -- https://master.php.net/note/edit/83623 Del: integrated -- https://master.php.net/note/delete/83623/integrated Del: useless -- https://master.php.net/note/delete/83623/useless Del: bad code -- https://master.php.net/note/delete/83623/bad+code Del: spam -- https://master.php.net/note/delete/83623/spam Del: non-english -- https://master.php.net/note/delete/83623/non-english Del: in docs -- https://master.php.net/note/delete/83623/in+docs Del: other reasons-- https://master.php.net/note/delete/83623 Reject -- https://master.php.net/note/reject/83623 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#140131) next »