- var_export: documentation ( source)
<?php
class cls
{
public static function meth(int $a, string $b) : void
{
throw new Exception;
}
public function meth2(int $a, string $b): void
{
throw new Exception;
}
}
try {
cls::meth(1,'hello');
}catch (\Throwable $t) {
var_export($t->getTrace());
echo "\n";
}
try {
(new cls)->meth2(1,'hello');
}catch (\Throwable $t) {
var_export($t->getTrace());
echo "\n";
}
function func()
{
throw new Exception;
}
try {
func();
}catch (\Throwable $t) {
var_export($t->getTrace());
echo "\n";
}
try{
(function() { throw new Exception;})();
}
catch (\Throwable $t) {
var_export($t->getTrace());
echo "\n";
}
try {
throw new Exception;
}
catch (\Throwable $t) {
var_export($t->getTrace());
echo "\n";
}