One helpful method for writing more concise PHP code is that of nesting functions within one other. Although this nesting doesn't appear to affect execution time significantly, it does create compact, elegant code.
For example, if we wanted to parse a string containing a first and last name and then rearrange the names within that string, we might do this:
//A name formatted 'last, first'
$name = 'Brown, Perry';
print "Name reformatted is $name";
//prints "Name reformatted is Perry Brown"
The key to nesting is simple: a function must be able to accept data of the same type as the function within it returns.
So, in the example above, explode( ) returns an array that array_reverse( ) can understand and manipulate. Then implode( ) manipulates the array that array_reverse( ) returns. And implode( ) returns a string assigned to $name, which can be printed.
This nesting principle can be applied more widely in PHP coding, but an obvious and practical application is when used with functions.