3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ "Cooking", "look", "I cant", "Walking the dog to the park", "washing", "talk", "one" ]; $maxLength = -1; $longestValue = null; foreach ($array as $value) { $length = strlen($value); if ($length > $maxLength) { $maxLength = $length; $longestValue = $value; } } var_export($longestValue);

preferences:
33.67 ms | 404 KiB | 5 Q