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){ echo json_encode(['status' => $status, 'values' => $values]); return true; }else{ echo json_encode(['status' => $status]); return true; } } public static function respond_catch($function_name, $parameters_array) { try{ $values = call_user_func_array($function_name, $parameters_array); } catch(Exception $e) { if($e->getMessage() != NULL ){ //There is a message self::respond($e->getMessage()); return false; }else{ self::respond('Nastala chyba. Skúste to znova prosím.'); return false; } } self::respond('OK', $values); } } $data = ['some','data']; post::respond_catch('bar:foo', [$data]);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function "bar:foo" not found or invalid function name in /in/KDcNs:26 Stack trace: #0 /in/KDcNs(44): post::respond_catch('bar:foo', Array) #1 {main} thrown in /in/KDcNs on line 26
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:
36.01 ms | 401 KiB | 8 Q