Can you do this

From: Date: Wed, 31 Jan 2001 15:03:33 +0000
Subject: Can you do this
Groups: php.general 
Request: Send a blank email to php-general+get-37484@lists.php.net to get a copy of this message
Academic curiosity - You can do the following: echo "3 - 2 = " . ( bcsub( 3, 2 )); and PHP evaluates the expression in parenthesis (in this case a function) before it evaluates the echo statement and what gets printed out is: 3 - 2 = 1 Now, say I have a function where one of the arguments is passed by reference and is modified within the function. I can call this function on one line myFunc( &$modifiedVariable ); and print out the value (if any) of $modifiedVariable on the next echo $modifiedVariable. So what I am wondering is if you can turn those two statements into one? The function is going to get evaluated first we already know, but I am not certain how I could get the (new) value of $modifiedVariable. Yes, it's just one extra line but that is not why I ask. I was thinking about it yesterday and I became very curious if it could even be done. Nothing I tried yielded results so I'm turning to the experts. :p Is this possible? Thanks for entertaining my curiosity! Chris

« previous php.general (#37484) next »