PHP Doku:: Reading [] - migration51.reading.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchAppendicesMigrating from PHP 5.0.x to PHP 5.1.xReading []

Ein Service von Reinhard Neidl - Webprogrammierung.

Migrating from PHP 5.0.x to PHP 5.1.x

<<Changes in reference handling

Integer values in function parameters>>

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.


Keine BenutzerBeiträge.
- Beiträge aktualisieren...



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)