aboutsummaryrefslogtreecommitdiffhomepage
path: root/catchline.php
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2023-02-14 23:04:39 +0900
committernsfisis <nsfisis@gmail.com>2023-02-14 23:04:39 +0900
commita28bf70d0bfd2d94fb1f1ea561f40661cbddf3d4 (patch)
treea886e4fa63bfdd90fe9bfd088c6aec53c0b84731 /catchline.php
parentae5b7a122f8e24dd38faa476cb3a1ec84f13b564 (diff)
downloadphpstudy-149-slides-a28bf70d0bfd2d94fb1f1ea561f40661cbddf3d4.tar.gz
phpstudy-149-slides-a28bf70d0bfd2d94fb1f1ea561f40661cbddf3d4.tar.zst
phpstudy-149-slides-a28bf70d0bfd2d94fb1f1ea561f40661cbddf3d4.zip
枚数、分量を削減HEADmain
Diffstat (limited to 'catchline.php')
-rw-r--r--catchline.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/catchline.php b/catchline.php
index 058abeb..97f3c93 100644
--- a/catchline.php
+++ b/catchline.php
@@ -2,14 +2,16 @@
try {
f(3);
} catch (Throwable $e) {
- while ($e = $e->getPrevious()) printf('%c', $e->getLine() + 23);
+ do {
+ printf('%c', $e->getLine() + 21);
+ } while ($e = $e->getPrevious());
echo "\n";
}
function f(int $i) {
- if ($i < 0) f();
+ if ($i < 0) return;
try {
match ($i) {
- 0 => X, // 12行目
+ 0 => X, // 14行目
@@ -46,7 +48,7 @@ function f(int $i) {
- 2 => X, // 49行目
+ 2 => X, // 51行目
@@ -54,7 +56,7 @@ function f(int $i) {
- 1, 3 => X, // 57行目
+ 1, 3 => X, // 59行目
};
} finally {
f($i - 1);