Iam a beginner of PHP .
My question is soo small.
Suppose , my current value is 250 Taka.
or
BDT 250 /-
How can i show only price : 250 ?
My code :
$maxprice= "250 Taka.";
<td style="width: 20%;"><?php echo $maxprice; ?></td>
Thanks
Iam a beginner of PHP .
My question is soo small.
Suppose , my current value is 250 Taka.
or
BDT 250 /-
How can i show only price : 250 ?
My code :
$maxprice= "250 Taka.";
<td style="width: 20%;"><?php echo $maxprice; ?></td>
Thanks
You can use preg_replace
and replace everything not a digit
$maxprice = preg_replace('/[^\d]+/', '', $maxprice);
The Regx is pretty simple:
[^...]+
anything not in character set One or more times\d
any digit 0-9So it replaces anything that is not 0-9.
Enjoy