3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = [ '+2347036756899', '+234-7036-756899', '+2347036-756899', '+234-7036756899', '07036756899', '0-7036756899', '07036-756899', '08036756899', ]; foreach ($tests as $test) { printf( "%20s : %s\n", $test, preg_match('/^(?:\+234(-)?|0)(?:[78]0|81)\d{2}(?(1)-|)\d{6}$/', $test) ? '✅' : '❌' ); }

preferences:
15.5 ms | 402 KiB | 5 Q