3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $number = '(+0031)6 12 34 56 77'; $number = str_replace(['(', ' ', ')'], '', $number); // 0xxxxxxxxx if (strlen($number) == 10) { if (0 === strpos($number, '0')) { $result = true; } // 31xxxxxxxxx } elseif (strlen($number) == 11) { if (0 === strpos($number, '31')) { $result = true; } // +31xxxxxxxxx } elseif (strlen($number) == 12) { if (0 === strpos($number, '+31')) { $result = true; } // 0031xxxxxxxxx } elseif (strlen($number) == 13) { if (0 === strpos($number, '0031')) { $result = true; } } var_dump($result);
based on Qqq9R
Output for 5.6.0 - 7.3.0alpha1
Notice: Undefined variable: result in /in/jprGG on line 28 NULL