Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • \$\begingroup\$ Counting the PHP open tag is not needed when the code can be run as php -r '…' (where -r is for free). And definitely no need for the long form, as short_open_tag is on by default. \$\endgroup\$ Commented Sep 12, 2016 at 9:55
  • \$\begingroup\$ As far as I know $argv doesn't work with -r so this can't be run like that anyway. That said changing it to readline() or fgets(STDIN) if you're on windows and running without the tag is probably shorter anyway. \$\endgroup\$ Commented Sep 12, 2016 at 13:56
  • \$\begingroup\$ -r and $argv are working well together: pastebin.com/vcgb5pT2 \$\endgroup\$ Commented Sep 12, 2016 at 14:19
  • \$\begingroup\$ Huh. Well it doesn't work for me, I just get undefined variable notices, I wonder if it's a setting or if it's just windows as per usual. \$\endgroup\$ Commented Sep 12, 2016 at 15:41
  • \$\begingroup\$ You can still replace <?php with <? to save three bytes. \$\endgroup\$ Commented Sep 12, 2016 at 18:24