By the way, beware of possibly buggy code: strpos() will return 0 if the string begins with '-', but it will return FALSE if '-' is not found in the string.
Since both 0 and FALSE will evaluate to boolean false in your condition, you may get weird results. Use this instead: (strpos($a, '-') !== FALSE) ? "Jimmy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > 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. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php