<?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";
}
- Output for 8.4.1
- array (
0 =>
array (
'file' => '/in/iQoni',
'line' => 17,
'function' => 'meth',
'class' => 'cls',
'type' => '::',
'args' =>
array (
0 => 1,
1 => 'hello',
),
),
)
array (
0 =>
array (
'file' => '/in/iQoni',
'line' => 24,
'function' => 'meth2',
'class' => 'cls',
'type' => '->',
'args' =>
array (
0 => 1,
1 => 'hello',
),
),
)
array (
0 =>
array (
'file' => '/in/iQoni',
'line' => 35,
'function' => 'func',
'args' =>
array (
),
),
)
array (
0 =>
array (
'file' => '/in/iQoni',
'line' => 42,
'function' => '{closure:/in/iQoni:42}',
'args' =>
array (
),
),
)
array (
)
- Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.14
- array (
0 =>
array (
'file' => '/in/iQoni',
'line' => 17,
'function' => 'meth',
'class' => 'cls',
'type' => '::',
'args' =>
array (
0 => 1,
1 => 'hello',
),
),
)
array (
0 =>
array (
'file' => '/in/iQoni',
'line' => 24,
'function' => 'meth2',
'class' => 'cls',
'type' => '->',
'args' =>
array (
0 => 1,
1 => 'hello',
),
),
)
array (
0 =>
array (
'file' => '/in/iQoni',
'line' => 35,
'function' => 'func',
'args' =>
array (
),
),
)
array (
0 =>
array (
'file' => '/in/iQoni',
'line' => 42,
'function' => '{closure}',
'args' =>
array (
),
),
)
array (
)
preferences:
76.66 ms | 410 KiB | 5 Q