downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  

<Changes in reference handlingInteger values in function parameters>
Last updated: Thu, 26 Jun 2008

Reading []

<?php
class XmlTest {

   function
test_ref(&$test) {
      
$test = "ok";
   }

   function
test($test) { }

   function
run() {
      
$ar = array();
      
$this->test_ref($ar[]);
      
var_dump($ar);
      
$this->test($ar[]);
   }
}

$o = new XmlTest();
$o->run();
?>

This should always have thrown a fatal E_ERROR, because [] cannot be used for reading in PHP. It is invalid code in PHP 4.4.2 and PHP 5.0.5 upward.



add a noteadd a note User Contributed Notes
Reading []
There are no user contributed notes for this page.




<Changes in reference handlingInteger values in function parameters>
Last updated: Thu, 26 Jun 2008
show source | credits | sitemap | contact | advertising | mirror sites
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://phpbuilder.com/
Last updated: Tue Nov 1 20:20:59 2005 EST
Columns / Articles | Tips / Quickies | News | News Linking and RSS Feeds | Shared Code Library
Mail Archives | Support / Discussion Forums | Get Started! Links | Contribute! | Docs