3v4l.org

run code in 300+ PHP versions simultaneously
<?php $obj = (object)array( 1 => 'value of 1', 'x' => 'value of x', ); function get_real_object_vars($obj) { if (version_compare(PHP_VERSION, '5.0.0') >= 0) { class StdclassIterator implements Iterator { private $subject; public function __construct($object) { $this->subject = $object; } public function current() { return current($this->subject); } public function next() { next($this->subject); } public function key() { return key($this->subject); } public function valid() { $key = key($this->subject); return NULL !== key($this->subject); } public function rewind() { reset($this->subject); } } return iterator_to_array(new StdclassIterator($obj)); } else { return get_object_vars($obj); } } var_dump($obj, get_real_object_vars($obj));
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of StdclassIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/sZoH9 on line 18 Deprecated: Return type of StdclassIterator::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/sZoH9 on line 23 Deprecated: Return type of StdclassIterator::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/sZoH9 on line 28 Deprecated: Return type of StdclassIterator::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/sZoH9 on line 33 Deprecated: Return type of StdclassIterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/sZoH9 on line 39 Deprecated: reset(): Calling reset() on an object is deprecated in /in/sZoH9 on line 41 Deprecated: key(): Calling key() on an object is deprecated in /in/sZoH9 on line 35 Deprecated: key(): Calling key() on an object is deprecated in /in/sZoH9 on line 36 Deprecated: current(): Calling current() on an object is deprecated in /in/sZoH9 on line 20 Deprecated: key(): Calling key() on an object is deprecated in /in/sZoH9 on line 30 Deprecated: next(): Calling next() on an object is deprecated in /in/sZoH9 on line 25 Deprecated: key(): Calling key() on an object is deprecated in /in/sZoH9 on line 35 Deprecated: key(): Calling key() on an object is deprecated in /in/sZoH9 on line 36 Deprecated: current(): Calling current() on an object is deprecated in /in/sZoH9 on line 20 Deprecated: key(): Calling key() on an object is deprecated in /in/sZoH9 on line 30 Deprecated: next(): Calling next() on an object is deprecated in /in/sZoH9 on line 25 Deprecated: key(): Calling key() on an object is deprecated in /in/sZoH9 on line 35 Deprecated: key(): Calling key() on an object is deprecated in /in/sZoH9 on line 36 object(stdClass)#1 (2) { ["1"]=> string(10) "value of 1" ["x"]=> string(10) "value of x" } array(2) { [1]=> string(10) "value of 1" ["x"]=> string(10) "value of x" }

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:
37.55 ms | 409 KiB | 8 Q