PHP 2??? Pretpostavljam da mislis na PHP/FI?
http://www.php.net/manual/en/history.php.php
Ajd da se ne foliramo ovde, sumnjam da je bilo ko sa ovih prostora radio ista ozbiljno pre verzije 3.0 (ja sam istu ukacio 2000-te ali sam ozbiljno programiranje u PHP-u poceo bas u trenucima kada se pojavio PHP4).
Inace ne mogu da kazem da sam isprobavao $foo[x] ali u manualu je jasno bilo navedeno da se koristi viticasta zagrada. Uostalom evo i dokaza iz Web Archive (PHP manual iz 2003 godine)
http://web.archive.org/web/200304011...pes.string.php
Citat:
String access by character
Characters within strings may be accessed by specifying the zero-based offset of the desired character after the string in curly braces.
Note: For backwards compatibility, you can still use array-braces for the same purpose. However, this syntax is deprecated as of PHP 4.
Example 7-3. Some string examples
PHP kôd:
<?php
// Get the first character of a string
$str = 'This is a test.';
$first = $str{0};
// Get the third character of a string
$third = $str{2};
// Get the last character of a string.
$str = 'This is still a test.';
$last = $str{strlen($str)-1};
?>
|