diff options
| author | nsfisis <nsfisis@gmail.com> | 2023-02-12 19:09:52 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2023-02-12 20:52:47 +0900 |
| commit | ae5b7a122f8e24dd38faa476cb3a1ec84f13b564 (patch) | |
| tree | 4aa1167b52e50e7c0baed5cb34ed37fd6c2a4ec1 /catchline.php | |
| parent | 09831c67395848379506ca30f284310c9887572b (diff) | |
| download | phpstudy-149-slides-ae5b7a122f8e24dd38faa476cb3a1ec84f13b564.tar.gz phpstudy-149-slides-ae5b7a122f8e24dd38faa476cb3a1ec84f13b564.tar.zst phpstudy-149-slides-ae5b7a122f8e24dd38faa476cb3a1ec84f13b564.zip | |
スライドを作成
Diffstat (limited to 'catchline.php')
| -rw-r--r-- | catchline.php | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/catchline.php b/catchline.php new file mode 100644 index 0000000..058abeb --- /dev/null +++ b/catchline.php @@ -0,0 +1,62 @@ +<?php +try { + f(3); +} catch (Throwable $e) { + while ($e = $e->getPrevious()) printf('%c', $e->getLine() + 23); + echo "\n"; +} +function f(int $i) { + if ($i < 0) f(); + try { + match ($i) { + 0 => X, // 12行目 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2 => X, // 49行目 + + + + + + + + 1, 3 => X, // 57行目 + }; + } finally { + f($i - 1); + } +} |
