Get first value of comma separated string

arrays, php

Solution

How about

echo reset(explode(',', 'a,b,c,d'))

Problem

I'm looking for the quickest/shortest way to get the first value from comma separated string, in-line. The best I can do is ``` $string = 'a,b,c,d'; echo "The first thing is " . end(array_reverse(explode(',', $string))) . "."; ``` but I feel that's excessive and redundant. Is there a better way?

Original source

Related problems