the code “ : ” in php

前端 未结 7 715
难免孤独
难免孤独 2020-12-22 13:40

I\'m curious to know what the syntax \" : \" mean in php I\'ve seen it a couple of times but I can\'t seem to explain it to myself. Can you also use it in a sentence....or i

相关标签:
7条回答
  • 2020-12-22 14:12

    It's the ternary operator:

    echo ($a == 1 ? "A is 1" : "A is not 1");
    
    0 讨论(0)
提交回复
热议问题