1/* most basic usage */
2$var = 5;
3$var_is_greater_than_two = ($var > 2 ? true : false); // returns true
1<?php
2#Syntex
3(if Condition) ? (stat1) : (stat2);
4
5#example
6$var1 = 5;
7$var2 = 2;
8
9echo $check = ($var1 > $var2) ? "right" : "wrong";
10
11#output : right
12/*
13explination : if condition is true then display the stat1 and if condition is
14worng then display stat2
15*/
16?>
1.wp-block-code {
2 border: 0;
3 padding: 0;
4}
5
6.wp-block-code > div {
7 overflow: auto;
8}
9
10.shcb-language {
11 border: 0;
12 clip: rect(1px, 1px, 1px, 1px);
13 -webkit-clip-path: inset(50%);
14 clip-path: inset(50%);
15 height: 1px;
16 margin: -1px;
17 overflow: hidden;
18 padding: 0;
19 position: absolute;
20 width: 1px;
21 word-wrap: normal;
22 word-break: normal;
23}
24
25.hljs {
26 box-sizing: border-box;
27}
28
29.hljs.shcb-code-table {
30 display: table;
31 width: 100%;
32}
33
34.hljs.shcb-code-table > .shcb-loc {
35 color: inherit;
36 display: table-row;
37 width: 100%;
38}
39
40.hljs.shcb-code-table .shcb-loc > span {
41 display: table-cell;
42}
43
44.wp-block-code code.hljs:not(.shcb-wrap-lines) {
45 white-space: pre;
46}
47
48.wp-block-code code.hljs.shcb-wrap-lines {
49 white-space: pre-wrap;
50}
51
52.hljs.shcb-line-numbers {
53 border-spacing: 0;
54 counter-reset: line;
55}
56
57.hljs.shcb-line-numbers > .shcb-loc {
58 counter-increment: line;
59}
60
61.hljs.shcb-line-numbers .shcb-loc > span {
62 padding-left: 0.75em;
63}
64
65.hljs.shcb-line-numbers .shcb-loc::before {
66 border-right: 1px solid #ddd;
67 content: counter(line);
68 display: table-cell;
69 padding: 0 0.75em;
70 text-align: right;
71 -webkit-user-select: none;
72 -moz-user-select: none;
73 -ms-user-select: none;
74 user-select: none;
75 white-space: nowrap;
76 width: 1%;
77}<?php
78
79if (condition) {
80 $result = value1;
81} else {
82 $result = value2;
83}
84Code language: HTML, XML (xml)