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. Quote 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 ^^ Quote 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]+$ Quote Link to comment https://forums.phpfreaks.com/topic/190433-how-to-echo-regex/#findComment-1004533 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.