3v4l.org

run code in 300+ PHP versions simultaneously
<?php function var_types() { $bt = debug_backtrace()[0]; $file = new \SPLFileObject($bt['file']); $file->seek($bt['line'] - 1); $line = $file->current(); $matchs = null; preg_match('/var_types\((.*)\)/', $line, $matchs); $param_names = array_map('trim', explode(",", $matchs[1])); $args = func_get_args(); for ($i = 0; $i < count($args); $i++) { echo $param_names[$i] . ' ' . gettype($args[$i]) . PHP_EOL; } } define('MY_CONSTANT', 1); $string = "STR"; $num = 123.4; var_types(MY_CONSTANT, $string, $num, $_GET, $_SERVER['PHP_SELF']);

preferences:
52.28 ms | 402 KiB | 5 Q