3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function array_exclude(array $arr, array $blacklist){ return array_diff_key($arr, array_flip($blacklist)); } function resource($data) { $name = $data["name"]; $prefix = isset($data["prefix"]) ? $data["prefix"] : ""; $except = isset($data["except"]) ? $data["except"] : []; $methods = $this->array_exclude(['create', 'edit', 'delete'], $except); $result = []; foreach($methods as $method){ array_push($result, "$prefix.$name.$method"); } return $result; } function makePermissions($blueprint){ $result = []; foreach ($blueprint as $item){ switch(gettype($item)){ case "string": array_push($result, $item); break; case "array": $result = array_merge($result, $this->resource($item)); break; } } return $result; } print_f(makePermissions([]));
Output for 7.0.0 - 7.3.0rc3
Fatal error: Uncaught Error: Call to undefined function print_f() in /in/C6HCr:34 Stack trace: #0 {main} thrown in /in/C6HCr on line 34
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: Call to undefined function print_f() in /in/C6HCr:34 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Fatal error: Call to undefined function print_f() in /in/C6HCr on line 34
Process exited with code 255.