3v4l.org

run code in 300+ PHP versions simultaneously
<?php class bar { public static function foo($data) { return $data; } } class post { public static function respond($status, $values = NULL) { if($values != NULL){ echo json_encode(['status' => $status, 'values' => $values]); return true; }else{ echo json_encode(['status' => $status]); return true; } return false; } public static function respond_catch($function, $parameters_array) { try{ $values = call_user_func_array($function_name, $parameters_array); } catch(Exception $e) { if($e->getMessage() != NULL ){ //There is a message echo json_encode(['status' => $default_message]); return false; }else{ //otherwise echo json_encode(['status' => 'Nastala chyba. Skúste to znova prosím.']); return false; } } echo json_encode(['status' => 'OK', 'values' => $values]); return true; } } $data = ['some','data']; post::respond_catch('bar:foo', [$data]);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $function_name in /in/c2FAf on line 28 Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, no array or string given in /in/c2FAf:28 Stack trace: #0 /in/c2FAf(48): post::respond_catch('bar:foo', Array) #1 {main} thrown in /in/c2FAf on line 28
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
46.98 ms | 401 KiB | 8 Q