-2

when I get input from cli, I var_dump it and this showed for me:

    string(2) "Y
"

So how I understand I receive the single char and the bag of blank spaces, so this code will return false ($input == "Y"). How I can solve this issue?

nowiko
  • 2,507
  • 6
  • 38
  • 82

1 Answers1

1

You can easily remove all this whitespace using trim()

(trim($input) == 'Y')
MightyPork
  • 18,270
  • 10
  • 79
  • 133