leaf wrote:
Actually I choose array_pop for 2 reasons.
I like short code. I don't want to read thousands of lines just to get
an idea. I tend to think in very compact code. if you find that ugly and
unreadable. that's your preference. I find extended coding very ugly,
mostly because I'm a slow reader, and that is my preference
And what about someone else that has to read/maintain your code in the
future? What about when you come to read a "clever" but compact line of
code that does 5 or 6 things on a single line, a few years down the
track, and spend valuable time just trying to figure out what it
actually does?
I got use to working with pop and shift while I was doing perl work. so
to me pop'ing an array makes perfect sense.
Sure, when there actually *is* an array to pop. In the following
situation there is no array to actually pop (remove and return) the last
element from, since you're using the return value of explode() while
array_pop() expects a reference to a variable:
$element = array_pop( explode( ',', $some_string ) );
--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php