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

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -