3v4l.org

run code in 500+ PHP versions simultaneously
<?php use function PHPStan\dumpType; final class SinglePickSKU { public function renderEditControls(string $id): string { preg_match('/(\d+)$/', $id, $result); $counter = ''; if (is_numeric($result[1])) { if ($result[1] < 10) { $counter = '0' . $result[1] . '. '; } else { $counter = $result[1] . '. '; } } var_dump($counter); $html = ''; $html .= doFoo($counter . 'abc'); return $html; } } function doFoo(string $s):string { return $s; } $s = new SinglePickSKU(); $s->renderEditControls('');
Output for 8.2.31 - 8.2.33, 8.3.0 - 8.3.33, 8.4.1 - 8.4.25, 8.5.0 - 8.5.10
Warning: Undefined array key 1 in /in/fbc2F on line 12 string(0) ""

preferences:
47.12 ms | 789 KiB | 4 Q