LoginSignup
0
0

More than 1 year has passed since last update.

php emptyで0も空になる

Posted at

empty()は0も入る

phpのempty()を実行すると0も空になる

$ php 221015.php
[0=>グー,1=>チョキ,2=>パー]:0
empty
0

簡単なじゃんけんを作って実行

こうならないために

empty.php
    if($stdin_num === ""){
        echo 'empty'.PHP_EOL;
        return false;
    }

でしてみた。もっと簡単な方法探す。
文字列は判定してくれるかも。

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0