3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ruleTypes() { $types = [0 => ['min' => 2, 'max' => 5, 'required'=> 1]]; $ruleArray = []; $arr = []; foreach ($types as $type) { foreach ($type as $key => $value) { if ($value) { if (\in_array($value, getNoValidationValueRequired()){ $ruleArray[] = $value; }else { $ruleArray[] = $key . ':' . $value; } } } } return implode('|', $ruleArray); } getNoValidationValueRequired(): array { return ['required']; }
Output for 7.1.0 - 7.1.21, 7.2.0 - 7.2.9
Parse error: syntax error, unexpected ';' in /in/of8rW on line 13
Process exited with code 255.

preferences:
174.82 ms | 1395 KiB | 39 Q