From 45f9b8108fbe9858054ed3ca884a2b1101f9bd66 Mon Sep 17 00:00:00 2001 From: Márton Polgár <37218286+2colours@users.noreply.github.com> Date: Wed, 12 Jun 2024 16:38:13 +0200 Subject: 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. --- challenge-270/2colours/php/ch-2.php | 6 +++--- 1 file 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); -- cgit