callback function return return($var & 1)?

前端 未结 8 2060
灰色年华
灰色年华 2020-12-05 22:07

I have read the PHP Manuel about array_filter



        
相关标签:
8条回答
  • 2020-12-05 22:58

    & is bitwise "and" operator. With 1, 3, 5 (and other odd numbers) $var & 1 will result in "1", with 0, 2, 4 (and other even numbers) - in "0".

    0 讨论(0)
  • 2020-12-05 22:58

    it returns 0 or 1, depending on your $var

    if $var is odd number, ex. (1, 3, 5 ...) it $var & 1 returns 1, otherwise (2, 4, 6) $var & 1 returns 0

    0 讨论(0)
提交回复
热议问题