note 111327 deleted from function.intval by danbrown
| From: | danbrown@php.net | Date: | Tue, 05 Mar 2013 16:12:19 +0000 |
| Subject: | note 111327 deleted from function.intval by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-193930@lists.php.net to get a copy of this message | ||
Note Submitter: yura at chetverikov dot org
----
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
}
?>