note 111327 modified in function.intval by danbrown
| From: | danbrown@php.net | Date: | Tue, 05 Mar 2013 16:12:10 +0000 |
| Subject: | note 111327 modified in function.intval by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-193929@lists.php.net to get a copy of this message | ||
Sometimes you need to convert price (string) to integers,
e.g.:
<?php
$price = 'From $7 to $11';
$sep = 'to';
$parts = explode($sep,$price);
foreach($parts as &$part) {
$part = str2int($part,true); // using str2int michiel ed thalent nl
}
?>
--was--
Sometimes you need to convert price (string) to integers,
e.g.:
$price = 'From $7 to $11';
$sep = 'to';
$parts = explode($sep,$price);
foreach($parts as &$part) {
$part = str2int($part,true); // using str2int michiel ed thalent nl
}
http://php.net/manual/en/function.intval.php