3v4l.org

run code in 200+ PHP versions simultaneously
<?php $str = "ab9c5lek94ke2koe8nsk9"; echo preg_replace('/(\d)([^\d]*)(\d)([^\d]*)(\d)([^\d]*)$/',"<b>$1</b>$2<b>$3</b>$4<b>$5</b>$6",$str);
Output for 7.2.0 - 7.4.2
ab9c5lek94ke<b>2</b>koe<b>8</b>nsk<b>9</b>