<?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\""; }
You have javascript disabled. You will not be able to edit any code.