Can you write the following in one line of code?
$foo = explode(":", $foo);
$foo = $foo[0];
Can you write the following in one line of code?
$foo = explode(":", $foo);
$foo = $foo[0];
Yes, it's posible to do using list
:
list($foo) = explode(":", $foo);
As an alternative to list(), you may use array_shift()
$foo = array_shift(explode(':', $foo));