답변 5개 / 댓글 3개
condition ? A : B ;
--> condition이 참이면 A, 거짓이면 B 사용 의미.
+ Expressions (표현식)
- https://www.php.net/manual/en/language.expressions.php
- http://docs.php.net/manual/kr/language.expressions.php
There is one more expression that may seem odd if you haven't seen it in other languages, the ternary conditional operator:
다른 언어에서 본적이 없다면 이상하게 보이는 표현식이 있다. 3중 조건적 연산자이다:
<?php
$first ? $second : $third
?>
If the value of the first subexpression is true (non-zero), then the second subexpression is evaluated, and that is the result of the conditional expression. Otherwise, the third subexpression is evaluated, and that is the value.
first 에 속하는 표현식의 값이 TRUE (non-zero)이면 second 에 속하는 표현식이 적용되고, 이것이 조건적 표현식의 결과가 된다. 이 경우가 아니면, third 에 속하는 표현식이 적용되고, 그 값이 된다.
3항연산식.. 3항 연산식으로 페이징 짜고
3항연산식을 if문으로 재해석하려고 하면
미쳐버림.
그중에서도 아주 if문 바꿔보라 도발해보라는 식의 3항연산식 짜놓아둔 페이징.
그러나 자체적 오류가 있어서 버그
답변을 작성하려면 로그인이 필요합니다.