Re: concatenating with "." or ","

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

 



On 25 Aug 2008, at 16:09, Govinda wrote:
Good, understood.

To deepen (for me):

why does this:
echo '<p>$_POST[\'SNGstep\']='.var_dump($_POST['SNGstep']).'^</ p>'."\n";
spit out:
"NULL
<p>$_POST['SNGstep']=^</p>"

while this:
echo '<p>$_POST[\'SNGstep\']=',var_dump($_POST['SNGstep']),'^</ p>'."\n";
spits out:
"<p>$_POST['SNGstep']=NULL
^</p>"

?

I think it must be related to something Maciek was showing in his excellent example, but I am too green to see.

Oone is a concatenated string, the other is arguments. Arguments are executed and output in order, whereas the concatenation causes the function calls to be executed first and then the echo to display the return values concatenated into a single string.

Because var_dump *outputs* stuff rather than returning it, in the concatenation version the NULL outputs before the rest of the string.

Hope that clears it up.

-Stut

--
http://stut.net/

On Aug 25, 2008, at 7:48 AM, Thiago Melo de Paula wrote:

Govinda,

please, consider the following code:

<?php
$brandA = 'Porshe';
$brandB = 'Jaguar';

$testA = $branA . $brandB; //testA will have the value PorsheJaguar

$testB = $branA , $brandB; //Returns a Parse error: syntax error, unexpected
',' in /test.php on line 7
?>


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