3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'This is day 7 of the task'; if ($int = filter_var($string, FILTER_SANITIZE_NUMBER_INT)) { echo "Found \"$int\" inside of $string"; } else { echo "No integers found inside of $string"; } echo "\n---\n"; $string = 'This is a day of the week'; if ($int = filter_var($string, FILTER_SANITIZE_NUMBER_INT)) { echo "Found \"$int\" inside of \"$string\""; } else { echo "No integers found inside of \"$string\""; }

preferences:
35.16 ms | 404 KiB | 5 Q