aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMárton Polgár <37218286+2colours@users.noreply.github.com>2024-06-12 16:38:13 +0200
committerGitHub <noreply@github.com>2024-06-12 16:38:13 +0200
commit45f9b8108fbe9858054ed3ca884a2b1101f9bd66 (patch)
tree9d0b592273ef5a6b605a0a7cb88cc490213fba59
parent32a782c2f060936d2a755a389afad36a90308268 (diff)
downloadperlweeklychallenge-club-45f9b8108fbe9858054ed3ca884a2b1101f9bd66.tar.gz
perlweeklychallenge-club-45f9b8108fbe9858054ed3ca884a2b1101f9bd66.tar.bz2
perlweeklychallenge-club-45f9b8108fbe9858054ed3ca884a2b1101f9bd66.zip
fix(ch-2): coerce the input to numbers
It's not a good idea to keep "numeric strings" around when one wants to use === sometimes. This might have ruined some corner cases I haven't tested; 0 weights in particular.
-rw-r--r--challenge-270/2colours/php/ch-2.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/challenge-270/2colours/php/ch-2.php b/challenge-270/2colours/php/ch-2.php
index ed56d8867b..c543067f12 100644
--- a/challenge-270/2colours/php/ch-2.php
+++ b/challenge-270/2colours/php/ch-2.php
@@ -94,8 +94,8 @@ const BRACKETS = ['[', ']'];
echo '@ints = ';
$ints = json_decode(str_replace(PARENS, BRACKETS, fgets(STDIN)));
echo '$x = ';
-$x = fgets(STDIN);
+$x = +fgets(STDIN);
echo '$y = ';
-$y = fgets(STDIN);
+$y = +fgets(STDIN);
-echo solve($ints, $x, $y); \ No newline at end of file
+echo solve($ints, $x, $y);