Re: echo VS print : that's a cool behavior !
| From: | tedd | Date: | Tue, 23 Oct 2007 16:06:50 +0000 |
| Subject: | Re: echo VS print : that's a cool behavior ! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263551@lists.php.net to get a copy of this message | ||
At 11:46 AM -0400 10/23/07, Robert Cummings wrote:
On Tue, 2007-10-23 at 17:34 +0200, Julien Pauli wrote:Rob: Good call on the 1 return. Maybe this will help: http://www.webbytedd.com/bbb/echo-print/ Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com<?php echo "coucou " . print('v ' . print('u ' . print('toctoc ') . 'hihi ') ) . 'tata ' . print('zozo ' . print('pupu '));That's not cool, that's a mess. Why doe sit happen the way it does? First off, print() is a function so nesting functions means the innermost functions get processed first, this is why the output has mangled order. The 1's show up in the output because you're concatenating the return value of the print() function which is true for success. Cheers, Rob. --