On Nov 13, 2009, at 6:34 PM, Jim Lucas wrote:
You basic problem with the PHP_EOL is that when echo'ed out, it
represents a \n character.
The value you are working with might be \n\r or just \r
I read the links you sent, plus some others. It took me awhile, but
I get it now. If the "return character" that was entered into that
field is not the same as what PHP_EOL is looking for, it won't work.
$parts = preg_split('|[\n\r]+|', $item['unitprice']);
preg_split works perfectly! Very similar to Perl's split function.
Here's what I have now:
$parts = preg_split('|\s+|', $item['unitprice']);
$price = '$'.number_format((count($parts) > 1) ?
$parts[(count($parts)-1)] : $parts[0],2);
Clean and concise. Thanks a million, Jim! I really appreciate your
helpful responses.
Thanks again,
Frank
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php