3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classes = array('DateInterval', 'DateTimeImmutable', 'DateTime', 'DateTimeZone'); foreach ($classes as $class){ echo "Signature of $class::_set_state\n"; try{ $rm = new ReflectionMethod($class, '__set_state'); var_dump($rm->getNumberOfParameters()); var_dump($rm->getNumberOfRequiredParameters()); } catch(Exception $e) { echo "$class: " . $e; } } echo "End of param counts for __set_state\n\n"; try { var_export(DateTime::__set_state(array( 'date' => '2017-06-08 05:11:40.907706', 'timezone_type' => 3, 'timezone' => 'UTC', ))); } catch(Error $e) { echo "Couldn't call DateTime::__set_state: " . $e . "\n"; } // DateTime::__set_state(); // would trigger Warning: DateTime::__set_state() expects exactly 1 parameter, 0 given in php shell code on line 1 // needs 2, datefmt and bool, according to docs (not 100% sure) echo "datefmt_set_lenient\n"; $rf = new ReflectionFunction('datefmt_set_lenient'); var_dump($rf->getNumberOfParameters()); var_dump($rf->getNumberOfRequiredParameters());
Output for git.master, git.master_jit, rfc.property-hooks
Signature of DateInterval::_set_state int(1) int(1) Signature of DateTimeImmutable::_set_state int(1) int(1) Signature of DateTime::_set_state int(1) int(1) Signature of DateTimeZone::_set_state int(1) int(1) End of param counts for __set_state \DateTime::__set_state(array( 'date' => '2017-06-08 05:11:40.907706', 'timezone_type' => 3, 'timezone' => 'UTC', ))datefmt_set_lenient int(2) int(2)

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