#26759 [Com]: php documentation examples contain slow code
| From: | amaranth at phphacking dot com | Date: | Thu, 01 Jan 2004 18:26:58 +0000 |
| Subject: | #26759 [Com]: php documentation examples contain slow code | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969357810@lists.php.net to get a copy of this message | ||
ID: 26759
Comment by: amaranth at phphacking dot com
Reported By: kennyt@php.net
Status: Bogus
Bug Type: Documentation problem
PHP Version: Irrelevant
Assigned To: kennyt
New Comment:
I agree that the code examples in the manual teach bad habits. People
use them and don't realize there is a better solution, so they write
everything with this slower code. Once a script gets large enough these
do add up but by then its too late because so many lines would have to
be changed. If the manual showed better examples or at least told
people about the faster solutions it would fix a lot of headaches.
Previous Comments:
------------------------------------------------------------------------
[2004-01-01 05:55:31] derick@php.net
Don't smoke too much in the new year please.
------------------------------------------------------------------------
[2004-01-01 04:51:12] vrana@php.net
Double quotes and concatenation in output don't cause significant lost
in performance. foreach too, furthermore it's better readable than
while.
Just my opinion.
------------------------------------------------------------------------
[2004-01-01 01:47:21] kennyt@php.net
Those 'insignificant gains' do add up. Does anyone want
to teach new PHP developers to [ab]use the language
like that? [Not meaning to bait any flames; just trying
to help]
Ignoring any arguments about the necessity in real
code, does anyone have objections?
------------------------------------------------------------------------
[2004-01-01 01:40:29] ben at slax0rnet dot com
I truly can't believe the pickiness present here. In a lot of these
cases the "optimizations" to example code would not equate to any
significant gain in performance.
------------------------------------------------------------------------
[2003-12-31 22:46:16] kennyt@php.net
Description:
------------
The php.net manual contains lots of examples that use
less than desirable coding styles, such as unnecessary
double quotes, concatenation in output (echo
'foo'.$bar;), bloaty loops (foreach(), which wastes
memory, when just a while() is needed), etc.
I'm happy to hit a good number of these pages, but I
don't want to get killed over it. ;-)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=26759&edit=1