- is_numeric: documentation ( source)
- print_r: documentation ( source)
- str_split: documentation ( source)
- ord: documentation ( source)
<?php
$string = "123Bonjour456";
$stringArray = str_split($string);
foreach ($stringArray as $key=>$letter) {
if (!is_numeric($letter)) {
$string[$key] = ord($letter);
}
}
print_r($string);