Re: Quick Poll: PHP 4 / 5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




----- Original Message ----- From: "Jasper Bryant-Greene" <jasper@xxxxxxxxxxxxxxxxxx>
To: <php-general@xxxxxxxxxxxxx>
Sent: Friday, September 16, 2005 11:14 PM
Subject: Re:  Quick Poll: PHP 4 / 5


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 think in compact code. so reading it back is not a problem. As for future programmers who want to look at my code? That's never happened so far. However I do keep good documentation. so reading and understanding my code shouldn't be a problem.


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 ) );
No array to pop? .. explode returns an array. doesn't matter if its temporary or has a variable assigned to it. its still an array.


--
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



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux