I\'m using a template engine that inserts code in my site where I want it.
I wrote a function to test for something which is quite easy:
myfunction()
It is possible from PHP version 5.4.
If you don't want a temporary variable for that and your PHP version is less, than 5.4, than you still can use a few built in functions to get the first or the last element:
$x = 'first?last';
$first = array_shift(explode('?', $x));
$last = end(explode('?', $x));
$last2 = array_pop(explode('?', $x));
Edit: !!! Please note, that in later versions( 5.4+ ) PHP will throw a notice, because end only expects variables as parameter.