string - Calling PHP explode and access first element? -
string - Calling PHP explode and access first element? -
possible duplicate: php syntax dereferencing function result
i have string, looks 1234#5678. calling this:
$last = explode("#", "1234#5678")[1]
its not working, there syntax error...but where? expect 5678 in $last
. not working in php?
array dereferencing not possible in current php versions (unfortunately). can utilize list
[docs] straight assign array elements variables:
list($first, $last) = explode("#", "1234#5678");
update
since php 5.4 (released 01-mar-2012) supports array dereferencing.
php string explode
Comments
Post a Comment