3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Filter { protected $pattern; protected $repl; function __construct($pattern, $repl) { $this->pattern = $pattern; $this->repl = $repl; } function filter($data) { return preg_replace($this->pattern, $this->repl, $data); } function __destruct(){ echo "BYE BITCH\n"; } }; class Post { protected $title; protected $text; protected $filters; function __construct($title, $text, $filters) { $this->title = $title; $this->text = $text; $this->filters = $filters; } function get_title() { return htmlspecialchars($this->title); } function display_post() { $text = htmlspecialchars($this->text); foreach ($this->filters as $filter) $text = $filter->filter($text); return $text; } function __destruct() { // debugging stuff $s = "<!-- POST " . htmlspecialchars($this->title); $text = htmlspecialchars($this->text); echo 'WOAH ITS A FILTER '.'"'.$this->filters.'"'; foreach ($this->filters as $filter) $text = $filter->filter($text); $s = $s . ": " . $text; $s = $s . " -->"; echo $s; } }; $standard_filter_set = [new Filter("/\[i\](.*)\[\/i\]/i", "<i>\\1</i>"), new Filter("/\[b\](.*)\[\/b\]/i", "<b>\\1</b>"), new Filter("/\[img\](.*)\[\/img\]/i", "<img src='\\1'>"), new Filter("/\[br\]/i", "<br>")]; unserialize(serialize(new Post("hue", "br", [new Filter("/gibe/", "gibe moni"), new Filter("/moni/", "i repor u")]))); unserialize('O:4:"Post":3:{s:8:"*title";s:3:"hue";s:7:"*text";s:2:"br";s:10:"*filters";a:2:{i:0;O:6:"Filter":2:{s:10:"*pattern";s:6:"/gibe/";s:7:"*repl";s:9:"gibe moni";}i:1;O:6:"Filter":2:{s:10:"*pattern";s:6:"/moni/";s:7:"*repl";s:9:"i repor u";}}}');
Output for git.master, git.master_jit
Warning: Array to string conversion in /in/JF2mG on line 43 WOAH ITS A FILTER "Array"<!-- POST hue: br -->BYE BITCH BYE BITCH Warning: Array to string conversion in /in/JF2mG on line 43 WOAH ITS A FILTER "Array"<!-- POST hue: br -->BYE BITCH BYE BITCH Notice: unserialize(): Error at offset 27 of 237 bytes in /in/JF2mG on line 58 Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /in/JF2mG on line 41 Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /in/JF2mG on line 42 WOAH ITS A FILTER "" Warning: foreach() argument must be of type array|object, null given in /in/JF2mG on line 44 <!-- POST : -->BYE BITCH BYE BITCH BYE BITCH BYE BITCH
Output for rfc.property-hooks
Warning: Array to string conversion in /in/JF2mG on line 43 WOAH ITS A FILTER "Array"<!-- POST hue: br -->BYE BITCH BYE BITCH Warning: Array to string conversion in /in/JF2mG on line 43 WOAH ITS A FILTER "Array"<!-- POST hue: br -->BYE BITCH BYE BITCH Warning: unserialize(): Error at offset 27 of 237 bytes in /in/JF2mG on line 58 Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /in/JF2mG on line 41 Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in /in/JF2mG on line 42 WOAH ITS A FILTER "" Warning: foreach() argument must be of type array|object, null given in /in/JF2mG on line 44 <!-- POST : -->BYE BITCH BYE BITCH BYE BITCH BYE BITCH

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:
58.47 ms | 402 KiB | 8 Q