[Solved] PHP – How do I convert string number to number [closed]


For PHP you can do something like this:

$string = "one two three four five six seven eight nine
One Two Three Four Five Six Seven Eight Nine
oNE tWO tHREE fOuR fIVE sIX sEVEN eIGHT nINE
ONE TWO THREE FOuR FIVE SIX SEVEN EIGHT NINE";

$replace = array(0,1,2,3,4,5,6,7,8,9);
$search = array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');

echo str_ireplace($search, $replace, $string);

As Fred -ii- pointed in his comment str_ireplace will do the trick for insensitive replacement.

10

solved PHP – How do I convert string number to number [closed]