1Expressions in static scalar context
2-----
3<?php
4
5const T_1 = 1 << 1;
6const T_2 = 1 / 2;
7const T_3 = 1.5 + 1.5;
8const T_4 = "foo" . "bar";
9const T_5 = (1.5 + 1.5) * 2;
10const T_6 = "foo" . 2 . 3 . 4.0;
11const T_7 = __LINE__;
12const T_8 = <<<ENDOFSTRING
13This is a test string
14ENDOFSTRING;
15const T_9 = ~-1;
16const T_10 = (-1?:1) + (0?2:3);
17const T_11 = 1 && 0;
18const T_12 = 1 and 1;
19const T_13 = 0 || 0;
20const T_14 = 1 or 0;
21const T_15 = 1 xor 1;
22const T_16 = 1 xor 0;
23const T_17 = 1 < 0;
24const T_18 = 0 <= 0;
25const T_19 = 1 > 0;
26const T_20 = 1 >= 0;
27const T_21 = 1 === 1;
28const T_22 = 1 !== 1;
29const T_23 = 0 != "0";
30const T_24 = 1 == "1";
31const T_25 = 1 + 2 * 3;
32const T_26 = "1" + 2 + "3";
33const T_27 = 2 ** 3;
34const T_28 = [1, 2, 3][1];
35const T_29 = 12 - 13;
36const T_30 = 12 ^ 13;
37const T_31 = 12 & 13;
38const T_32 = 12 | 13;
39const T_33 = 12 % 3;
40const T_34 = 100 >> 4;
41const T_35 = !false;
42-----
43array(
44    0: Stmt_Const(
45        consts: array(
46            0: Const(
47                name: Identifier(
48                    name: T_1
49                )
50                value: Expr_BinaryOp_ShiftLeft(
51                    left: Scalar_Int(
52                        value: 1
53                    )
54                    right: Scalar_Int(
55                        value: 1
56                    )
57                )
58            )
59        )
60    )
61    1: Stmt_Const(
62        consts: array(
63            0: Const(
64                name: Identifier(
65                    name: T_2
66                )
67                value: Expr_BinaryOp_Div(
68                    left: Scalar_Int(
69                        value: 1
70                    )
71                    right: Scalar_Int(
72                        value: 2
73                    )
74                )
75            )
76        )
77    )
78    2: Stmt_Const(
79        consts: array(
80            0: Const(
81                name: Identifier(
82                    name: T_3
83                )
84                value: Expr_BinaryOp_Plus(
85                    left: Scalar_Float(
86                        value: 1.5
87                    )
88                    right: Scalar_Float(
89                        value: 1.5
90                    )
91                )
92            )
93        )
94    )
95    3: Stmt_Const(
96        consts: array(
97            0: Const(
98                name: Identifier(
99                    name: T_4
100                )
101                value: Expr_BinaryOp_Concat(
102                    left: Scalar_String(
103                        value: foo
104                    )
105                    right: Scalar_String(
106                        value: bar
107                    )
108                )
109            )
110        )
111    )
112    4: Stmt_Const(
113        consts: array(
114            0: Const(
115                name: Identifier(
116                    name: T_5
117                )
118                value: Expr_BinaryOp_Mul(
119                    left: Expr_BinaryOp_Plus(
120                        left: Scalar_Float(
121                            value: 1.5
122                        )
123                        right: Scalar_Float(
124                            value: 1.5
125                        )
126                    )
127                    right: Scalar_Int(
128                        value: 2
129                    )
130                )
131            )
132        )
133    )
134    5: Stmt_Const(
135        consts: array(
136            0: Const(
137                name: Identifier(
138                    name: T_6
139                )
140                value: Expr_BinaryOp_Concat(
141                    left: Expr_BinaryOp_Concat(
142                        left: Expr_BinaryOp_Concat(
143                            left: Scalar_String(
144                                value: foo
145                            )
146                            right: Scalar_Int(
147                                value: 2
148                            )
149                        )
150                        right: Scalar_Int(
151                            value: 3
152                        )
153                    )
154                    right: Scalar_Float(
155                        value: 4
156                    )
157                )
158            )
159        )
160    )
161    6: Stmt_Const(
162        consts: array(
163            0: Const(
164                name: Identifier(
165                    name: T_7
166                )
167                value: Scalar_MagicConst_Line(
168                )
169            )
170        )
171    )
172    7: Stmt_Const(
173        consts: array(
174            0: Const(
175                name: Identifier(
176                    name: T_8
177                )
178                value: Scalar_String(
179                    value: This is a test string
180                )
181            )
182        )
183    )
184    8: Stmt_Const(
185        consts: array(
186            0: Const(
187                name: Identifier(
188                    name: T_9
189                )
190                value: Expr_BitwiseNot(
191                    expr: Expr_UnaryMinus(
192                        expr: Scalar_Int(
193                            value: 1
194                        )
195                    )
196                )
197            )
198        )
199    )
200    9: Stmt_Const(
201        consts: array(
202            0: Const(
203                name: Identifier(
204                    name: T_10
205                )
206                value: Expr_BinaryOp_Plus(
207                    left: Expr_Ternary(
208                        cond: Expr_UnaryMinus(
209                            expr: Scalar_Int(
210                                value: 1
211                            )
212                        )
213                        if: null
214                        else: Scalar_Int(
215                            value: 1
216                        )
217                    )
218                    right: Expr_Ternary(
219                        cond: Scalar_Int(
220                            value: 0
221                        )
222                        if: Scalar_Int(
223                            value: 2
224                        )
225                        else: Scalar_Int(
226                            value: 3
227                        )
228                    )
229                )
230            )
231        )
232    )
233    10: Stmt_Const(
234        consts: array(
235            0: Const(
236                name: Identifier(
237                    name: T_11
238                )
239                value: Expr_BinaryOp_BooleanAnd(
240                    left: Scalar_Int(
241                        value: 1
242                    )
243                    right: Scalar_Int(
244                        value: 0
245                    )
246                )
247            )
248        )
249    )
250    11: Stmt_Const(
251        consts: array(
252            0: Const(
253                name: Identifier(
254                    name: T_12
255                )
256                value: Expr_BinaryOp_LogicalAnd(
257                    left: Scalar_Int(
258                        value: 1
259                    )
260                    right: Scalar_Int(
261                        value: 1
262                    )
263                )
264            )
265        )
266    )
267    12: Stmt_Const(
268        consts: array(
269            0: Const(
270                name: Identifier(
271                    name: T_13
272                )
273                value: Expr_BinaryOp_BooleanOr(
274                    left: Scalar_Int(
275                        value: 0
276                    )
277                    right: Scalar_Int(
278                        value: 0
279                    )
280                )
281            )
282        )
283    )
284    13: Stmt_Const(
285        consts: array(
286            0: Const(
287                name: Identifier(
288                    name: T_14
289                )
290                value: Expr_BinaryOp_LogicalOr(
291                    left: Scalar_Int(
292                        value: 1
293                    )
294                    right: Scalar_Int(
295                        value: 0
296                    )
297                )
298            )
299        )
300    )
301    14: Stmt_Const(
302        consts: array(
303            0: Const(
304                name: Identifier(
305                    name: T_15
306                )
307                value: Expr_BinaryOp_LogicalXor(
308                    left: Scalar_Int(
309                        value: 1
310                    )
311                    right: Scalar_Int(
312                        value: 1
313                    )
314                )
315            )
316        )
317    )
318    15: Stmt_Const(
319        consts: array(
320            0: Const(
321                name: Identifier(
322                    name: T_16
323                )
324                value: Expr_BinaryOp_LogicalXor(
325                    left: Scalar_Int(
326                        value: 1
327                    )
328                    right: Scalar_Int(
329                        value: 0
330                    )
331                )
332            )
333        )
334    )
335    16: Stmt_Const(
336        consts: array(
337            0: Const(
338                name: Identifier(
339                    name: T_17
340                )
341                value: Expr_BinaryOp_Smaller(
342                    left: Scalar_Int(
343                        value: 1
344                    )
345                    right: Scalar_Int(
346                        value: 0
347                    )
348                )
349            )
350        )
351    )
352    17: Stmt_Const(
353        consts: array(
354            0: Const(
355                name: Identifier(
356                    name: T_18
357                )
358                value: Expr_BinaryOp_SmallerOrEqual(
359                    left: Scalar_Int(
360                        value: 0
361                    )
362                    right: Scalar_Int(
363                        value: 0
364                    )
365                )
366            )
367        )
368    )
369    18: Stmt_Const(
370        consts: array(
371            0: Const(
372                name: Identifier(
373                    name: T_19
374                )
375                value: Expr_BinaryOp_Greater(
376                    left: Scalar_Int(
377                        value: 1
378                    )
379                    right: Scalar_Int(
380                        value: 0
381                    )
382                )
383            )
384        )
385    )
386    19: Stmt_Const(
387        consts: array(
388            0: Const(
389                name: Identifier(
390                    name: T_20
391                )
392                value: Expr_BinaryOp_GreaterOrEqual(
393                    left: Scalar_Int(
394                        value: 1
395                    )
396                    right: Scalar_Int(
397                        value: 0
398                    )
399                )
400            )
401        )
402    )
403    20: Stmt_Const(
404        consts: array(
405            0: Const(
406                name: Identifier(
407                    name: T_21
408                )
409                value: Expr_BinaryOp_Identical(
410                    left: Scalar_Int(
411                        value: 1
412                    )
413                    right: Scalar_Int(
414                        value: 1
415                    )
416                )
417            )
418        )
419    )
420    21: Stmt_Const(
421        consts: array(
422            0: Const(
423                name: Identifier(
424                    name: T_22
425                )
426                value: Expr_BinaryOp_NotIdentical(
427                    left: Scalar_Int(
428                        value: 1
429                    )
430                    right: Scalar_Int(
431                        value: 1
432                    )
433                )
434            )
435        )
436    )
437    22: Stmt_Const(
438        consts: array(
439            0: Const(
440                name: Identifier(
441                    name: T_23
442                )
443                value: Expr_BinaryOp_NotEqual(
444                    left: Scalar_Int(
445                        value: 0
446                    )
447                    right: Scalar_String(
448                        value: 0
449                    )
450                )
451            )
452        )
453    )
454    23: Stmt_Const(
455        consts: array(
456            0: Const(
457                name: Identifier(
458                    name: T_24
459                )
460                value: Expr_BinaryOp_Equal(
461                    left: Scalar_Int(
462                        value: 1
463                    )
464                    right: Scalar_String(
465                        value: 1
466                    )
467                )
468            )
469        )
470    )
471    24: Stmt_Const(
472        consts: array(
473            0: Const(
474                name: Identifier(
475                    name: T_25
476                )
477                value: Expr_BinaryOp_Plus(
478                    left: Scalar_Int(
479                        value: 1
480                    )
481                    right: Expr_BinaryOp_Mul(
482                        left: Scalar_Int(
483                            value: 2
484                        )
485                        right: Scalar_Int(
486                            value: 3
487                        )
488                    )
489                )
490            )
491        )
492    )
493    25: Stmt_Const(
494        consts: array(
495            0: Const(
496                name: Identifier(
497                    name: T_26
498                )
499                value: Expr_BinaryOp_Plus(
500                    left: Expr_BinaryOp_Plus(
501                        left: Scalar_String(
502                            value: 1
503                        )
504                        right: Scalar_Int(
505                            value: 2
506                        )
507                    )
508                    right: Scalar_String(
509                        value: 3
510                    )
511                )
512            )
513        )
514    )
515    26: Stmt_Const(
516        consts: array(
517            0: Const(
518                name: Identifier(
519                    name: T_27
520                )
521                value: Expr_BinaryOp_Pow(
522                    left: Scalar_Int(
523                        value: 2
524                    )
525                    right: Scalar_Int(
526                        value: 3
527                    )
528                )
529            )
530        )
531    )
532    27: Stmt_Const(
533        consts: array(
534            0: Const(
535                name: Identifier(
536                    name: T_28
537                )
538                value: Expr_ArrayDimFetch(
539                    var: Expr_Array(
540                        items: array(
541                            0: ArrayItem(
542                                key: null
543                                value: Scalar_Int(
544                                    value: 1
545                                )
546                                byRef: false
547                                unpack: false
548                            )
549                            1: ArrayItem(
550                                key: null
551                                value: Scalar_Int(
552                                    value: 2
553                                )
554                                byRef: false
555                                unpack: false
556                            )
557                            2: ArrayItem(
558                                key: null
559                                value: Scalar_Int(
560                                    value: 3
561                                )
562                                byRef: false
563                                unpack: false
564                            )
565                        )
566                    )
567                    dim: Scalar_Int(
568                        value: 1
569                    )
570                )
571            )
572        )
573    )
574    28: Stmt_Const(
575        consts: array(
576            0: Const(
577                name: Identifier(
578                    name: T_29
579                )
580                value: Expr_BinaryOp_Minus(
581                    left: Scalar_Int(
582                        value: 12
583                    )
584                    right: Scalar_Int(
585                        value: 13
586                    )
587                )
588            )
589        )
590    )
591    29: Stmt_Const(
592        consts: array(
593            0: Const(
594                name: Identifier(
595                    name: T_30
596                )
597                value: Expr_BinaryOp_BitwiseXor(
598                    left: Scalar_Int(
599                        value: 12
600                    )
601                    right: Scalar_Int(
602                        value: 13
603                    )
604                )
605            )
606        )
607    )
608    30: Stmt_Const(
609        consts: array(
610            0: Const(
611                name: Identifier(
612                    name: T_31
613                )
614                value: Expr_BinaryOp_BitwiseAnd(
615                    left: Scalar_Int(
616                        value: 12
617                    )
618                    right: Scalar_Int(
619                        value: 13
620                    )
621                )
622            )
623        )
624    )
625    31: Stmt_Const(
626        consts: array(
627            0: Const(
628                name: Identifier(
629                    name: T_32
630                )
631                value: Expr_BinaryOp_BitwiseOr(
632                    left: Scalar_Int(
633                        value: 12
634                    )
635                    right: Scalar_Int(
636                        value: 13
637                    )
638                )
639            )
640        )
641    )
642    32: Stmt_Const(
643        consts: array(
644            0: Const(
645                name: Identifier(
646                    name: T_33
647                )
648                value: Expr_BinaryOp_Mod(
649                    left: Scalar_Int(
650                        value: 12
651                    )
652                    right: Scalar_Int(
653                        value: 3
654                    )
655                )
656            )
657        )
658    )
659    33: Stmt_Const(
660        consts: array(
661            0: Const(
662                name: Identifier(
663                    name: T_34
664                )
665                value: Expr_BinaryOp_ShiftRight(
666                    left: Scalar_Int(
667                        value: 100
668                    )
669                    right: Scalar_Int(
670                        value: 4
671                    )
672                )
673            )
674        )
675    )
676    34: Stmt_Const(
677        consts: array(
678            0: Const(
679                name: Identifier(
680                    name: T_35
681                )
682                value: Expr_BooleanNot(
683                    expr: Expr_ConstFetch(
684                        name: Name(
685                            name: false
686                        )
687                    )
688                )
689            )
690        )
691    )
692)
693