Voting

: max(one, nine)?
(Example: nine)

The Note You're Voting On

alreece45 at yahoo dot com
18 years ago
I haven't really read into it, but if you're complaining about a change in PHP 5.0.5 that made it so you couldn't do:

<?php

$val
= array_shift(preg_split());

?>

or

<?php

$val
= array_shit(function_that_returns_array);

?>

Then you're not using this function correctly. This function's argument is supposed to be a pointer to a variable. It then modifies that variable and returns a value. When you specify a function, php CAN NOT modify the return value of that function. It should be common sense but apparently its not.

Also, on a efficiency note, you might want to consider using another function such as reset or perhaps making your own function such as below:

<?php

function first_element($array) {

return
reset($array);

}

?>

Unless of course for some reason you need to save the microseconds this takes.

}

<< Back to user notes page

To Top