Re: RIGHT Function?

From: Date: Fri, 13 Nov 2009 23:50:52 +0000
Subject: Re: RIGHT Function?
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-299819@lists.php.net to get a copy of this message
Hi Jim,
$parts = explode(PHP_EOL, $item['unitprice']); $price = '$'.(( count($parts) > 1 ) ? $parts[0] : $parts[(count($parts)-1)]);
Thanks for the code! After reading up on PHP_EOL and explode, I now understand what you've done. However, can you tell me why you like this better? Is it because it is cleaner without the if/else statements, or is there more to it than that? Regards, Frank

« previous php.general (#299819) next »