3v4l.org

run code in 300+ PHP versions simultaneously
<?php foreach ((new ReflectionClass('\DateTime'))->getMethods() as $method) { if ($method->getName() == 'modify') { $returnType = $method->getTentativeReturnType(); if ($returnType instanceof ReflectionUnionType) { foreach ($returnType->getTypes() as $type) { var_dump($type->getName()); } } } }
Output for 8.4.1 - 8.4.12
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25
string(8) "DateTime" string(5) "false"

preferences:
60.07 ms | 407 KiB | 5 Q