if(strpos($a,'-')){
$a = explode('-',$a,2);
}else{
$a = array($a);
}
It's called the ternary conditional operator. Unfortunatley, it's buried in the PHP manual. http://us2.php.net/manual/en/language.expressions.php
Jimmy wrote:
I'm looking through some existing code for a project I'm working on, but I keep running into this syntax that I really don't understand. Here's an example:
$a=strpos($a,'-')?explode('-',$a,2):array($a);
What do the ? and the : do here? I'm seeing this sort of thing all over
and just have no idea what ? : do. Thanks.
-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php