jagoan-neon Posted January 31, 2010 Share Posted January 31, 2010 I want to extract a number + last 2 digit for example 23.72233113213 The result is 23.72 $order = 10000; $rp = 9500; $pay_pal = $order / $rp; $pay_pal = $pay_pal + ($pay_pal * 0.034) + 0.3; $pay_pal = preg_match("/[0-9]+\.[0-9]{2}/",$pay_pal); How to display $pay_pal ? Try to echo it but doesn't works. Thank you. Link to comment https://forums.phpfreaks.com/topic/190433-how-to-echo-regex/ Share on other sites More sharing options...
GrooN Posted January 31, 2010 Share Posted January 31, 2010 You can't display it because it returns false ^^ Link to comment https://forums.phpfreaks.com/topic/190433-how-to-echo-regex/#findComment-1004532 Share on other sites More sharing options...
jagoan-neon Posted January 31, 2010 Author Share Posted January 31, 2010 it return 1 or true; solved (?<=[0-9]+\.[0-9]{2})[0-9]+$ Link to comment https://forums.phpfreaks.com/topic/190433-how-to-echo-regex/#findComment-1004533 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.