3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $string = "Fasd-2"; $sub=substr($string, strrpos($string, "-")+1, strlen($string) - strrpos($string, "-")); if (is_numeric($sub)) { $newString = substr($string, 0, strlen($string) - strlen($sub) -1); $newString = $newString . "-" . $sub+1; } else { $newString = $string . "-1"; } echo $newString;
based on iuojl
Output for 7.1.0 - 7.3.0rc4
Warning: A non-numeric value encountered in /in/DqJl8 on line 8 1
Output for 5.3.20 - 7.0.20
1