Re: what does this line means? Many thanks
| From: | Alex Shi | Date: | Wed, 05 Sep 2001 20:55:37 +0000 |
| Subject: | Re: what does this line means? Many thanks | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-66112@lists.php.net to get a copy of this message | ||
In following formular,
exp ? statement1 : statement2
if exp is true, statement1 is excuted, else statement2 is excuted.
So it is equivalent to:
if( exp ) {
statement1
} else {
statement2
}
If you still want to ask what "?" means, I think it can be "if exp is true".
Alex
----- Original Message -----
From: "Sall Him" <sall_him@hotmail.com>
To: <php-general@lists.php.net>
Sent: Wednesday, September 05, 2001 4:44 PM
Subject: Re: [PHP] what does this line means? Many thanks
> thanks, another question is what does the ? means in this line?
>
> Alex Shi wrote:
> >
> > strstr($str, $needle) returns a substr start from first occurance of
$needle
> > in $str to the end of $str.
> >
> > strstr($value,"VLD:") != "" ? $VLD_CNDTNS[] =
> > strtr($value,"VLD:","") :
> > $SBMT_CNDTNS[] = $value;
> >
> > equivalent to:
> >
> > if( strstr($value, "VLD:") !="" ) {
> > $VLD_CNDTNS[] = strtr($value,"VLD:","");
> > } else {
> > $SBMT_CNDTNS[] = $value;
> > }
> >
> > This kind of express is borrowed from C.
> >
> > Alex
> >
> > ----- Original Message -----
> > From: "Sall Him" <sall_him@hotmail.com>
> > To: <php-general@lists.php.net>
> > Sent: Wednesday, September 05, 2001 3:35 PM
> > Subject: [PHP] what does this line means? Many thanks
> >
> > > strstr($value,"VLD:") != "" ? $VLD_CNDTNS[] =
> > > strtr($value,"VLD:","")
:
> > > $SBMT_CNDTNS[] = $value;
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > > For additional commands, e-mail: php-general-help@lists.php.net
> > > To contact the list administrators, e-mail:
php-list-admin@lists.php.net
> > >
> > >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>