On Fri, 9 Aug 2002, J-E-N wrote:
Hi!
This one:
$exp = "description=whatever\namount=23.50\nquantity=2\n";
if (preg_match("/amount=([0-9]{1,9}\.[0-9]{1,9})(\n)/", $exp,$amt)) {
print $amt[1];
}
will output "23.50"
and this one:
$exp = "description=whatever\namount=23.50\nquantity=2\n";
if (preg_match("/(amount=[0-9]{1,9}\.[0-9]{1,9})(\n)/", $exp,$amt)) {
print $amt[1];
}
will output "amount=23.50"
Regards
Urosh
> if i have the following script,
>
> $exp = "description=whatever\namount=23.50\nquantity=2\n";
> if (eregi("(amount)(.*)(\n)", $exp,$amt)) {
> print $amt[0];
> }
>
> the output will be
>
> namount=23.50\nquantity=2\n
>
>
> what will i do so that the output value will be 23.50 only.
>
>
> thanks =)
> jen
>
>
>
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php