|
Posted by Mladen Gogala on 12/28/05 18:33
On Wed, 28 Dec 2005 11:51:29 +0100, Moneypenny wrote:
> All gives a parse error.
>
> How can i do this?
>
> Tnx.
Well, everything else aside, there is a trick you can use:
$ cat /tmp/ttt
#!/usr/local/bin/php
<?php
$test=1;
$test == 1 ? eval('$do = true; $who = "me";') : $do = false;
echo "Do: $do Who:$who\n";
?>
$ php /tmp/ttt
Do: 1 Who:me
$
Of course, the code would be much more readable with if/then,
just as the others have told you.
--
http://www.mgogala.com
Navigation:
[Reply to this message]
|