3v4l.org

run code in 300+ PHP versions simultaneously
<?php class NewEraProxy { private $proxy_full_url; private $proxy_protocol; private $proxy_ssl; private $proxy_name; private $proxy_port; /** Constructor */ public function __construct($proxy_full_url) { $this->update_object($proxy_full_url); } /** Object updater */ public function update_object($proxy_full_url) { $this->proxy_full_url = $proxy_full_url; $this->proxy_ssl = ((strpos($this->proxy_full_url, 'ssl') === 0) ? true : false); $this->proxy_protocol = ($this->proxy_ssl ? 'ssl' : 'tcp'); // Grab other parameters if(false !== ($tmp = strpos($proxy_full_url, '://'))) $proxy_full_url = substr($proxy_full_url, $tmp + 3); $proxy_full_url = explode(':', $proxy_full_url); // Host, Port, Path $this->proxy_name = $proxy_full_url[0]; $this->proxy_port = (int)(isset($proxy_full_url[1]) ? $proxy_full_url[1] : ($this->proxy_ssl ? '443' : '80')); } /** Getter for the private properties */ public function __get($var) { $var = 'proxy_'.$var; if(isset($this->{$var})) return $this->{$var}; } } $newEraProxy = new NewEraProxy('tcp://127.0.0.1:8080'); var_dump($newEraProxy); var_dump($newEraProxy->full_url); var_dump($newEraProxy->protocol); var_dump($newEraProxy->ssl); var_dump($newEraProxy->name); var_dump($newEraProxy->port); var_dump($newEraProxy->non_existent_property);
Output for git.master, git.master_jit, rfc.property-hooks
object(NewEraProxy)#1 (5) { ["proxy_full_url":"NewEraProxy":private]=> string(20) "tcp://127.0.0.1:8080" ["proxy_protocol":"NewEraProxy":private]=> string(3) "tcp" ["proxy_ssl":"NewEraProxy":private]=> bool(false) ["proxy_name":"NewEraProxy":private]=> string(9) "127.0.0.1" ["proxy_port":"NewEraProxy":private]=> int(8080) } string(20) "tcp://127.0.0.1:8080" string(3) "tcp" bool(false) string(9) "127.0.0.1" int(8080) NULL

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