3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "087777807209"; // Original string $replacement = "62"; // What you want to replace the last character with // The final string $final = $replacement.substr($string, 0, 1); echo $final;

preferences:
55.72 ms | 402 KiB | 5 Q