I have a price field that sometimes contains entries like this:
How can I pull just the price ($5.32 in this example) from this
to display on a web page? Is there a RIGHT function in PHP? When I
search the PHP site, I'm being told there isn't one.
Here's the code I've been using:
substr will work from right to left.
If your data is in a variable do this;
echo substr($myData, -5);
Why -5? To account for 2 decimal places, the decimal and up to 99
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php