-
Notifications
You must be signed in to change notification settings - Fork 2
/
zend_op_array_en.html
1143 lines (1143 loc) · 33.3 KB
/
zend_op_array_en.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<html>
<title>ZEND_OP_ARRAY</title>
<body>
<h1 style="font-family: Arial; text-align: center;">Zend_Op_Array</h1>
<p style="text-align:center;">Modify by:MG193.7
<p style="text-align:center;"><a href="https://www.cnblogs.com/aldys4">My Blog</a>
<p style="text-align:center;"><a href="https://github.com/MG1937">My Github</a>
<p style="text-align:center;">Base on <a href="https://php.uz/manual/en/internals2.opcodes.php">vld document</a>
<p>
<table style="text-align: left; font-family: Arial; width: 100%;table-layout: fixed;word-break: break-all;" border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr style="text-align:left; vertical-align: top;font-family: Arial;font-weight: bold;">
<td width="20%">Opcode name</td>
<td>Explanation</td>
<td>Example (phpdbg)</td>
</tr>
<tr>
<td>NOP</td>
<td>no operation</td>
<td>NOP</td>
</tr>
<tr>
<td>ADD</td>
<td>Adds "value1" to "value2" and stores the result into "result".</td>
<td>ADD 1 2 ~0<br>
$a = 1+2;</td>
</tr>
<tr>
<td>SUB</td>
<td>Subtracts "value2" from "value1" and stores the result into "result".</td>
<td>SUB 2 1 ~0<br>
$a = 2-1;</td>
</tr>
<tr>
<td>MUL</td>
<td>Multiplys "value1" by "value2" and stores the result into "result".</td>
<td>MUL 1 2 ~0<br>
$a = 1*2;</td>
</tr>
<tr>
<td>DIV</td>
<td>Divides "value1" by "value2" and stores the result into "result".</td>
<td>DIV 6 3 ~0<br>
$a = 6/3;</td>
</tr><tr>
<td>MOD</td>
<td>Makes the value of "result" congruent to "value1" modulo "value2".</td>
<td>MOD 6 3 ~0<br>
$a = 6%3;</td>
</tr><tr>
<td>SL</td>
<td>Shift bits of value1 to the left value2 steps (each step means "multiply by two")</td>
<td>SL 8 2 ~0<br>
$a = 8<<2;</td>
</tr><tr>
<td>SR</td>
<td>Shift bits of value1 to the right value2 steps (each step means "divide by two")</td>
<td>SR 8 2 ~0<br>
$a = 8>>2;</td>
</tr><tr>
<td>CONCAT</td>
<td>Concats string values string1 and string2</td>
<td>CONCAT "A" "B" ~0<br>
echo "A"."B";</td>
</tr><tr>
<td>BW_OR</td>
<td>Bit-wise or of value1 and value2</td>
<td>BW_OR 1 2 ~0<br>
echo 1|2;</td>
</tr><tr>
<td>BW_AND</td>
<td>Bit-wise and of value1 and value2</td>
<td>BW_AND 1 2 ~0<br>
echo 1&2;</td>
</tr><tr>
<td>BW_XOR</td>
<td>Bit-wise xor of value1 and value2</td>
<td>BW_XOR 1 2 ~0<br>
echo 1^2;</td>
</tr><tr>
<td>BW_NOT</td>
<td>Bit-wise not of "value"</td>
<td>BW_NOT 15 ~0<br>
echo ~15;</td>
</tr><tr>
<td>BOOL_NOT</td>
<td>Boolean (logical) not of "value"</td>
<td>BOOL_NOT 1 ~0<br>
echo !1;</td>
</tr><tr>
<td>BOOL_XOR</td>
<td>Boolean (logical) xor of value1</td>
<td>BOOL 1 2 ~0<br>
echo 1 xor 2;</td>
</tr><tr>
<td>IS_IDENTICAL</td>
<td>Compares value1 and value2 to see if they are equal AND have the same type</td>
<td>IS_IDENTICAL 1 1 ~0<br>
echo (1===1);</td>
</tr><tr>
<td>IS_NOT_IDENTICAL</td>
<td>compares value1 and value2 to see if they are unequal or of different types</td>
<td>IS_NOT_IDENTICAL 1 1 ~0<br>
echo (1!==1);</td>
</tr><tr>
<td>IS_EQUAL</td>
<td>compares if value1 and value2 are equal</td>
<td>IS_EQUAL 1 1 ~0<br>
echo (1==1);</td>
</tr><tr>
<td>IS_NOT_EQUAL</td>
<td>compares if value1 and value2 are not equal</td>
<td>IS_NOT_EQUAL 1 1 ~0<br>
echo (1!=1);</td>
</tr><tr>
<td>IS_SMALLER</td>
<td>compares if value1 is less than value2</td>
<td>IS_SMALLER1 1 2 ~0<br>
echo (1 < 2);</td>
</tr><tr>
<td>IS_SMALLER_OR_EQUAL</td>
<td>compares if value1 is less than or equal to value2</td>
<td>IS_SMALLER_OR_EQUAL 2 1 ~0<br>
echo (2<=1);</td>
</tr><tr>
<td>CAST</td>
<td>casts value1 as type value2 (type in extended_value)</td>
<td>CAST<4> 1 ~0<br>
echo (int)1;</td>
</tr><tr>
<td>QM_ASSIGN</td>
<td>Question Mark Assign, used twice inside a question mark assign to temporarily assign result as value1 (this is followed up with an ASSIGN bytecode)</td>
<td>
JMPZ 1 J3<br>
QM_ASSIGN 1 ~0<br>
JMP J4<br>
QM_ASSIGN 2 ~0<br>
ECHO ~0<br>
echo (1?1:2);
</td>
</tr><tr>
<td>ASSIGN_ADD</td>
<td>Add value1 to value2 and store in variable indicated by value1</td>
<td>ASSIGN_ADD $a 2<br>
$a+=2;</td>
</tr><tr>
<td>ASSIGN_SUB</td>
<td>Subtract value1 from value2 and store in variable indicated by value1</td>
<td>ASSIGN_SUB $a 2<br>
$a-=2;</td>
</tr><tr>
<td>ASSIGN_MUL</td>
<td>Multiply result by value1 and store in variable indicated by result</td>
<td>ASSIGN_MUL $a 2<br>
$a*=2;</td>
</tr><tr>
<td>ASSIGN_DIV</td>
<td>Divide result by value1and store in variable indicated by result.</td>
<td>ASSIGN_DIV $a 2<br>
$a/=2;</td>
</tr><tr>
<td>ASSIGN_MOD</td>
<td>Perform result mod value1 and store in variable indicated by result</td>
<td>ASSIGN_MOD $a 2<br>
$a%=2;</td>
</tr><tr>
<td>ASSIGN_SL</td>
<td>Shift result by value1 bits to left and store in variable indicated by result</td>
<td>ASSIGN_SL $a 2<br>
$a<<=2;</td>
</tr><tr>
<td>ASSIGN_SR</td>
<td>Shift result by value1 bits to right and store in variable indicated by result</td>
<td>ASSIGN_SR $a 2<br>
$a>>=2;</td>
</tr><tr>
<td>ASSIGN_CONCAT</td>
<td>Concats string values result and value1 and store in variable indicated by result</td>
<td>ASSIGN_CONCAT $a 'z'<br>
$a.='z';</td>
</tr><tr>
<td>ASSIGN_BW_OR</td>
<td>Performs binary OR on result and value1 and stores in variable indicated by result.</td>
<td>ASSIGN_BW_OR $a 64<br>
$a|=64;</td>
</tr><tr>
<td>ASSIGN_BW_AND</td>
<td>Performs binary AND on result and value1 and stores in variable indicated by result.</td>
<td>ASSIGN_BW_AND $a 64<br>
$a &=64;</td>
</tr><tr>
<td>ASSIGN_BW_XOR</td>
<td>Performs binary XOR on result and value1and stores in variable indicated by result.</td>
<td>ASSIGN_BW_XOR $a 64<br>
$a ^=64;</td>
</tr><tr>
<td>PRE_INC</td>
<td>increments variable indicated by value1 by 1 (before performing other operations) and stores in result</td>
<td>PRE_INC $a<br>
++$a;</td>
</tr><tr>
<td>PRE_DEC</td>
<td>decrements variable indicated by value1 by 1 (before performing other operations) and stores in results</td>
<td>PRE_DEC $a<br>
--$a;</td>
</tr><tr>
<td>POST_INC</td>
<td>increments variable indicated by value1 by 1 (after performing other operations) and stores in result</td>
<td>POST_INC $a ~0<br>
$a++;</td>
</tr><tr>
<td>POST_DEC</td>
<td>decrements variable indicated by value1 by 1 (after performing other operations) and stores in result</td>
<td>POST_DEC $a ~0<br>
$a--;</td>
</tr><tr>
<td>ASSIGN</td>
<td>assigns value1 to result</td>
<td>ASSIGN $a $b<br>
$a=$b;</td>
</tr><tr>
<td>ASSIGN_REF</td>
<td>UNKNOW in phpdbg.<br>
Maybe you could refer to <a href="https://php.uz/manual/en/internals2.opcodes.assign-ref.php">ASSIGN_REF</a></td>
<td>UNKNOW</td>
</tr><tr>
<td>ECHO</td>
<td>Dump text</td>
<td>ECHO "hello world"<br>
echo "hello world";</td>
</tr><tr>
<td>PRINT</td>
<td>Same as ECHO?</td>
<td>ECHO<1> "hello world"<br>
print 'hello world';<br>
If you want to refer the opcodes in vld,<br>you could see <a href="https://php.uz/manual/en/internals2.opcodes.print.php">PRINT</a>
</td>
</tr><tr>
<td>JMP</td>
<td>Unconditonally jump to the address</td>
<td>#0 IS_EQUAL $a "a" ~0<br>
#1 JMPZ ~0 J4<br>
#2 ECHO 1<br>
#3 JMP J5<br>
#4 ECHO 2<br>
#5 RETURN<-1> 1<br><br>
if($a=="a"){echo 1;}else{echo 2;}</td>
</tr><tr>
<td>JMPZ</td>
<td>Jump to the address if the value is zero</td>
<td>You could see the opcodes in JMP</td>
</tr><tr>
<td>JMPNZ</td>
<td>Jump to the address if the value is not zero</td>
<td>...<br>
JMPNZ ~0 JX<br>
...<br><br>
if($b!=0){...}
</td>
</tr><tr>
<td>JMPZNZ</td>
<td>Jump to the address given in the operands if the value is zero;<br>jump to the address given in extended data if nonzero.</td>
<td>UNKNOW in phpdbg<br>
You could refer to <a href="https://php.uz/manual/en/internals2.opcodes.jmpznz.php">JMPZNZ</a></td>
</tr><tr>
<td>JMPZ_EX</td>
<td>Jump to the address if the value is zero.</td>
<td>#0 JMPZ_EX $a J2 ~0<br>
#1 BOOL true ~0<br>
#2 JMPZ ~0<br>
#3 RETURN<-1> 1<br><br>
if($a&&true){}</td>
</tr><tr>
<td>JMPNZ_EX</td>
<td>Jump to the address if the value is not zero.</td>
<td>#0 JMPZ_EX $a J2 ~0<br>
#1 BOOL true ~0<br>
#2 JMPZ ~0<br>
#3 RETURN<-1> 1<br><br>
if($a||true){}</td>
</tr><tr>
<td>CASE</td>
<td>UNKNOW</td>
<td>Do not found CASE opcode in phpdbg,<br>
You could refer to <a href="https://php.uz/manual/en/internals2.opcodes.case.php">CASE</a></td>
</tr><tr>
<td>SWITCH_FREE</td>
<td>Release the allocated space of "value"?</td>
<td>Do not found SWITCH_FREE in phpdbg,<br>
You could refer to <a href="https://php.uz/manual/en/internals2.opcodes.switch-free.php">SWITCH_FREE</a>
</td>
</tr><tr>
<td>BRK</td>
<td>It means "break" in vld,<br>But not found this opcode in phpdbg.<br>
If you want to break in while-loop(or something else),phpdbg will simply use JMP opcode jump out the loop,instead of use "BRK" opcode.</td>
<td>#0 JMP J2<br>
#1 JMP J3<br>
#2 JMPNZ 1 J1<br>
#3 RETURN<-1> 1<br><br>
while(1){break;}<br>
You also could see <a href="https://php.uz/manual/en/internals2.opcodes.brk.php">BRK</a></td>
</tr><tr>
<td>CONT</td>
<td>Same as BRK opcode,<br>
this opcode means "continue" in vld,<br>
But not found this opcode in phpdbg.<br>
phpdbg still use JMP to control the flow in loop.</td>
<td>You could refer to <a href="https://php.uz/manual/en/internals2.opcodes.cont.php">CONT</a></td>
</tr><tr>
<td>BOOL</td>
<td>convert value to boolean and store in result</td>
<td>#0 JMPZ_EX $a J2 ~0<br>
#1 BOOL true ~0<br>
#2 JMPZ ~0<br>
#3 RETURN<-1> 1<br><br>
if($a&&true){}</td>
</tr><tr>
<td>ROPE_INIT</td>
<td>when create a string that cotains variable,<br>
this opcode used to init this string and store the string of begining part to result</td>
<td>ROPE_INIT<3> "Test" ~1<br>
ROPE_ADD<1> ~1 $a ~1<br>
ROPE_END<2> ~1 " Test" ~0<br>
ECHO ~0<br><br>
echo "Test$a Test";</td>
</tr><tr>
<td>ROPE_ADD</td>
<td>after ROPE_INIT opcode,continue add a variable to string,and store the string to result.</td>
<td>Could see ROPE_INIT part</td>
</tr><tr>
<td>ROPE_END</td>
<td>after ROPE_INIT opcode,continue add a string to the whole string,and treat the string just added as the end of the whole string.</td>
<td>Could see ROPE_INIT part</td>
</tr><tr>
<td>FAST_CONCAT</td>
<td>concats value1 and value2,than stored it to the result</td>
<td>
FAST_CONCAT "Test" $a ~0<br>
ECHO ~0<br><br>
echo "Test$a";
</td>
</tr><tr>
<td>BEGIN_SILENCE</td>
<td>prepare to perform function call without displaying error messages</td>
<td>BEGIN_SILENCE ~0<br>
INIT_FCALL<1> 96 "file"<br>SEND_VAL"non_existent_file" 1<br>
DO_ICALL @1<br>
END_SILENCE ~0<br>
ASSIGN $a @1<br>
RETURN<-1> 1<br><br>
$a = @file("non_existent_file");</td>
</tr><tr>
<td>END_SILENCE</td>
<td>no longer surpress error messages</td>
<td>See BEGIN_SILENCE part</td>
</tr><tr>
<td>INIT_FCALL</td>
<td>init a function going to call</td>
<td>INIT_FCALL<1> 96 "abs"<br>
SEND_VAL 2 1<br>
DO_ICALL<br><br>
abs(2);</td>
</tr><tr>
<td>INIT_DYNAMIC_CALL</td>
<td>call to function dynamicly</td>
<td>ASSIGN $x "phpinfo"<br>
INIT_DYNAMIC_CALL $x<br>
DO_FCALL<br><br>
$x = 'phpinfo';<br>$x();</td>
</tr><tr>
<td>INIT_FCALL_BY_NAME</td>
<td>call to function</td>
<td>INIT_FCALL_BY_NAME "test"<br>
DO_FCALL @1<br>
ASSIGN $a @1<br><br>
$a = test();</td>
</tr><tr>
<td>DO_FCALL</td>
<td>Call a function.<br>
If the result of called function was stored to a variable,this opcode must take a result!</td>
<td>See INIT_DYNAMIC_CALL and INIT_FCALL_BY_NAME part</td>
</tr><tr>
<td>DO_FCALL_BY_NAME</td>
<td>Call a function by name.</td>
<td>UNKNOW in phpdbg,<br>
You could see <a href="https://php.uz/manual/en/internals2.opcodes.do-fcall-by-name.php">DO_FCALL_BY_NAME</a></td>
</tr><tr>
<td>RETURN</td>
<td>Return value from a funciton.</td>
<td>RETURN 1<br>
return 1;</td>
</tr><tr>
<td>RECV</td>
<td>Receive the number of functoin arguments</td>
<td>RECV 1 $a<br>
RETURN<-1> null<br><br>
function test($a){}</td>
</tr><tr>
<td>RECV_INIT</td>
<td>Initialize a function argument with "value" if not received from caller.<br>
Otherwise same as RECV.</td>
<td>RECV_INIT 1 "test" $t<br>
RETURN<-1> null<br><br>
function a($t="test"){}</td>
</tr><tr>
<td>SEND_VAL</td>
<td>Pass the constant value as an actual parameter to a function.</td>
<td>INIT_FCALL<2> 112 "hello"<br>
SEND_VAL "world" 1<br>
SEND_VAL "ok" 2<br>
DO_FCALL<br><br>
hello("world","ok");</td>
</tr><tr>
<td>SEND_VAL_EX</td>
<td>Pass the constant value as an actual parameter to a function.Same as SEND_VAL_EX</td>
<td>INIT_FCALL_BY_NAME<2> "hello"<br>
SEND_VAL_EX "world" 1<br>
SEND_VAL_EX "ok" 2<br>
DO_FCALL<br><br>
hello("world","ok");</td>
</tr><tr>
<td>SEND_VAR</td>
<td>Pass the variable value as an actual parameter to a function.</td>
<td>ASSIGN $a 1<br>
INIT_FCALL<1> 96 "abs"<br>
SEND_VAR $a 1<br>
DO_ICALL<br><br>
$a=1;abs($a);</td>
</tr><tr>
<td>SEND_VAR_EX</td>
<td>Pass the variable value as an actual parameter to a function.Same as SEND_VAR.</td>
<td>ASSIGN $a 1<br>
INIT_FCALL_BY_NAME<1> "test"<br>
SEND_VAR_EX $a 1<br>
DO_ICALL<br><br>
$a=1;test($a);</td>
</tr><tr>
<td>SEND_REF</td>
<td>Pass the reference value as an actual parameter to a function.</td>
<td>INIT_FCALL<1> 96 "each"<br>
SEND_REF $a 1<br>
DO_ICALL<br><br>
@each($a);</td>
</tr><tr>
<td>NEW</td>
<td>Construct an instance of "type" and store the reference to the object into "result".</td>
<td>NEW<2> "A" @1<br>
SEND_VAL_EX "a" 1<br>
DO_FCALL<br>
FREE @1<br><br>
new A("a");
</td>
</tr><tr>
<td>INIT_NS_FCALL_BY_NAME</td>
<td>No sample in vld or phpdbg.</td>
<td>UNKNOW</td>
</tr><tr>
<td>FREE</td>
<td>Release the allocated space of the value.</td>
<td>Could see NEW part</td>
</tr><tr>
<td>INIT_ARRAY</td>
<td>Allocate a new array with elem-value as the first element of the array.</td>
<td>UNKNOW in phpdbg,<br>
You could refer to <a href="https://php.uz/manual/en/internals2.opcodes.init-array.php">INIT_ARRAY</a></td>
</tr><tr>
<td>ADD_ARRAY_ELEMENT</td>
<td>Add elem-value as an element to array-value</td>
<td>UNKNOW in phpdbg,<br>
You could refer to <a href="https://php.uz/manual/en/internals2.opcodes.add-array-element.php">ADD_ARRAY_ELEMENT</a></td>
</tr><tr>
<td>INCLUDE_OR_EVAL</td>
<td>Include the file specified by filename and eval it.</td>
<td>INCLUDE_OR_EVAL<2> "test.php"<br>
INCLUDE_OR_EVAL<1> "echo 1;"<br><br>
include "test.php";<br>
eval("echo 1;");</td>
</tr><tr>
<td>UNSET_CV</td>
<td>Unset the variable.</td>
<td>UNSET_CV $A<br>
unset($A);</td>
</tr><tr>
<td>UNSET_VAR</td>
<td>Unset the variable.</td>
<td>ASSIGN $A "x"<br>
UNSET_VAR<4> $A<br><br>
$A="x";<br>
unset($$A);</td>
</tr><tr>
<td>UNSET_DIM</td>
<td>Unset the entry of array-value, which is specified by index</td>
<td>UNSET_DIM $A 0<br>
unset($A[0]);</td>
</tr><tr>
<td>UNSET_OBJ</td>
<td>Unset the property of the current object</td>
<td>UNSET_OBJ<8> $A "test"<br>
unset($A->test);</td>
</tr><tr>
<td>FE_RESET_R</td>
<td>Initialize an iterator on array-value. If the array is empty, jump to address.</td>
<td>#0 ASSIGN $a array(3)<br>
#1 FE_RESET_R $a J5 @1<br>
#2 FE_FETCH_R<96> @1 $num<br>
#3 ECHO<1> $num<br>
#4 JMP J2<br>
#5 FE_FREE @1<br><br>
$a = array(1,2,3);<br>
foreach($a as $num){<br>
print $num;<br>}</td>
</tr><tr>
<td>FE_FETCH_R</td>
<td>Fetch an element from iterator.<br>If no element is available, jump to the address that FE_RESET_R opcode setted.</td>
<td>Could see FE_RESET_R part.</td>
</tr><tr>
<td>EXIT</td>
<td>Exit running after dumping "message".</td>
<td>EXIT "foo"<br>
die("foo");</td>
</tr><tr>
<td>FETCH_R</td>
<td>fetch <a href="https://www.php.net/manual/en/language.variables.variable.php">Variable variables.</a></td>
<td>ASSIGN $a "x"<br>
FETCH_R<4> $a ~1<br>
ECHO ~1<br><br>
$a="x";<br>
echo $$a;</td>
</tr><tr>
<td>FETCH_DIM_R</td>
<td>fetch value of variables by index.</td>
<td>FETCH_R<4> $a ~1<br>
FETCH_DIM_R ~1 0 ~2<br>
ECHO ~2<br><br>
echo $$a[0];<br><br>
FETCH_DIM_R $x 0<br>
$x[0];</td>
</tr><tr>
<td>FETCH_OBJ_R</td>
<td>fetch property value of Variable variables</td>
<td>FETCH_R<4> $a ~1<br>
FETCH_OBJ_R ~1 "test" ~2<br>
ECHO ~2<br><br>
echo($$a->test);
</td>
</tr><tr>
<td>FETCH_W</td>
<td>fetch Variable variables and make it writable.</td>
<td>ASSIGN $x 1<br>
ASSIGN $a "x"<br>
FETCH_W<4> $a @2<br>
ASSIGN @2 2<br><br>
$x=1;<br>
$a="x";<br>
$$a=2;</td>
</tr><tr>
<td>FETCH_DIM_W</td>
<td>fetch Variable variables by index and make it writable.</td>
<td>FETCH_DIM_W $x 0 @0<br>
ASSIGN_DIM @0 1<br>
OP_DATA 2<br><br>
$x[0][1]=2;</td>
</tr><tr>
<td>FETCH_OBJ_W</td>
<td>fetch property value of Variable variables and make it writable.</td>
<td>FETCH_OBJ_W $x "t" @0<br>
ASSIGN_OBJ<16> @0 "test"<br>
OP_DATA 1<br><br>
$x->t->test=1;</td>
</tr><tr>
<td>FETCH_RW</td>
<td>fetch value of Variable variables.</td>
<td>FETCH_RW<4> $a @0<BR>
POST_INC @0;<br><br>
$$a++;</td>
</tr><tr>
<td>FETCH_DIM_RW</td>
<td>fetch value of Variable variables by index.</td>
<td>FETCH_DIM_RW $a 0 @0<br>
POST_INC @0<br><br>
$a[0]++;</td>
</tr><tr>
<td>FETCH_OBJ_RW</td>
<td>fetch property value of Variable variables</td>
<td>FETCH_OBJ_RW $a "b" @0<br>
POST_INC_OBJ<16> @0 "c"<br><br>
$a->b->c++;</td>
</tr><tr>
<td>FETCH_IS</td>
<td>Fetch the value from variable which is to be used to test if it is set or not, through isset()/isempty().</td>
<td>FETCH_IS<2> "_GET" ~0<br>
ISSET_ISEMPTY_DIM_OBJ ~0 0<br><br>
isset($_GET[0]);</td>
</tr><tr>
<td>FETCH_DIM_IS</td>
<td>No php sample.</td>
<td></td>
</tr><tr>
<td>FETCH_OBJ_IS</td>
<td>No php sample.</td>
<td></td>
</tr><tr>
<td>FETCH_FUNC_ARG</td>
<td>fetch value of Variable variables as arg of function</td>
<td>INIT_FCALL_BY_NAME<1> "test"<br>
CHECK_FUNC_ARG 1<BR>
FETCH_FUNC_ARG<4> $a @0<br>
SEND_FUNC_ARG @0 1<br>
DO_FCALL<br><br>
test($$a);</td>
</tr><tr>
<td>FETCH_DIM_FUNC_ARG</td>
<td>fetch value of variable by index as arg of function</td>
<td>INIT_FCALL_BY_NAME<1> "test"<br>
CHECK_FUNC_ARG 1<BR>
FETCH_DIM_FUNC_ARG $a 0 @0<BR>
SEND_FUNC_ARG @0 1<br>
DO_FCALL<br><br>
test($a[0]);</td>
</tr><tr>
<td>FETCH_OBJ_FUNC_ARG</td>
<td>fetch property value of variable as arg of function</td>
<td>INIT_FCALL_BY_NAME<1> "test"<br>
CHECK_FUNC_ARG 1<BR>
FETCH_OBJ_FUNC_ARG $a "b" @0<BR>
SEND_FUNC_ARG @0 1<br>
DO_FCALL<br><br>
test($a->b);</td>
</tr><tr>
<td>FETCH_UNSET</td>
<td>Fetch a variable for the purpose of unset() operation.</td>
<td>FETCH_UNSET<4> $A @1<br>
UNSET_DIM @1 0<br><br>
unset($$A[0]);</td>
</tr><tr>
<td>FETCH_DIM_UNSET</td>
<td>Fetch a variable by index for the purpose of unset() operation.</td>
<td>FETCH_DIM_UNSET $a 0 @0<br>
UNSET_OBJ @0 "b"<br><br>
unset($a[0]->b);</td>
</tr><tr>
<td>FETCH_OBJ_UNSET</td>
<td>Fetch a property value of variable for the purpose of unset() operation.</td>
<td>FETCH_OBJ_UNSET $a "b" @0<br>
UNSET_OBJ<16> @0 "c"<BR><BR>
unset($a->b->c);</td>
</tr><tr>
<td>FETCH_LIST_R</td>
<td>Fetch array list.</td>
<td>FETCH_LIST_R array(2) 0 @0<br>
ASSIGN $x @0<br>
FETCH_LIST_R array(2) 1 @2<br>
ASSIGN $b @2<br><br>
list($x,$b) = array("x","b");
</td>
</tr><tr>
<td>FETCH_DIM_TMP_VAR</td>
<td>No php sample in phpdbg</td>
<td>You could refer to <a href="https://php.uz/manual/en/internals2.opcodes.fetch-dim-tmp-var.php">FETCH_DIM_TMP_VAR</a></td>
</tr><tr>
<td>FETCH_CONSTANT</td>
<td>fetch value by const name.</td>
<td>FETCH_CONSTANT "A" ~0<br>
ECHO ~0<br><br>
echo A;</td>
</tr><tr>
<td>GOTO</td>
<td>No sample in phpdbg and vld,<br>
phpdbg use JMP opcode to control flow.</td>
<td></td>
</tr><tr>
<td>EXT_STMT</td>
<td>No php sample</td>
<td></td>
</tr><tr>
<td>EXT_FCALL_BEGIN</td>
<td>No php sample</td>
<td></td>
</tr><tr>
<td>EXT_FCALL_END</td>
<td>No php sample</td>
<td></td>
</tr><tr>
<td>EXT_NOP</td>
<td>No php sample</td>
<td></td>
</tr><tr>
<td>TICKS</td>
<td></td>
<td>TICKS<100><br>
declare(ticks=100);</td>
</tr><tr>
<td>SEND_VAR_NO_REF</td>
<td>No php sample</td>
<td></td>
</tr><tr>
<td>CATCH</td>
<td>catch when Exception get throw.</td>
<td>#0 THROW $t<br>
#1 JMP J4<br>
#2 CATCH<1> "A" $e<br>
#3 ECHO "catch"<br>
#4 RETURN<-1> 1<br><br>
try{throw $t}<br>
catch(A $e){echo "catch";}
</td>
</tr><tr>
<td>THROW</td>
<td>throw some Exception.</td>
<td>THROW $t<br>
throw $t;</td>
</tr><tr>
<td>FETCH_CLASS</td>
<td>fetch static class</td>
<td>FETCH_CLASS $obj @0<br>
FETCH_CLASS_CONSTANT @0 "a"<br><br>
$obj::a;</td>
</tr><tr>
<td>FETCH_CLASS_CONSTANT</td>
<td>fetch static constant from class</td>
<td>Could see FETCH_CLASS part.</td>
</tr><tr>
<td>FETCH_STATIC_PROP_R</td>
<td>fetch static property value from class</td>
<td>FETCH_CLASS $obj @0<br>
FETCH_STATIC_PROP_R "a" @0 ~1<br><br>
$obj::$a;</td>
</tr><tr>
<td>FETCH_STATIC_PROP_RW</td>
<td>fetch static property value from class,same as FETCH_STATIC_PROP_R but make it readable and writable.</td>
<td>FETCH_CLASS $obj @0<br>
FETCH_STATIC_PROP_RW "a" @0 @1<br>
POST_INC @1 ~2<BR><br>
$obj::$a++;</td>
</tr><tr>
<td>FETCH_STATIC_PROP_W</td>
<td>fetch static property value from class AND make it writable.</td>
<td>FETCH_CLASS $obj @0<br>
FETCH_STATIC_PROP_W "a" @0 @1<br>
ASSIGN @1 1<BR><br>
$obj::$a=1;</td>
</tr><tr>
<td>CLONE</td>
<td>clone an object</td>
<td>CLONE $t ~0<br>
clone $t;</td>
</tr><tr>
<td>RETURN_BY_REF</td>
<td>No sample in phpdbg</td>
<td></td>
</tr><tr>
<td>INIT_METHOD_CALL</td>
<td>Prepare for a method call. Followed by DO_FCALL.</td>
<td>INIT_METHOD_CALL $obj "a"<br>
DO_FCALL<br><br>
$obj->a();</td>
</tr><tr>
<td>INIT_STATIC_METHOD_CALL</td>
<td>Prepare for a static method call. Followed by DO_FCALL.</td>
<td>FETCH_CLASS $obj @0<br>
INIT_STATIC_METHOD_CALL @0 "a"<BR>
DO_FCALL<BR><br>
$obj::a();</td>
</tr><tr>
<td>ISSET_ISEMPTY_CV</td>
<td>check wether a variable is setted and store the result.</td>
<td>ISSET_ISEMPTY_CV $a ~0<br>
isset($a);</td>
</tr><tr>
<td>ISSET_ISEMPTY_VAR</td>
<td>check wether a variable is setted and store the result.</td>
<td>ISSET_ISEMPTY_VAR<4> $a ~0<br>
isset($$a);</td>
</tr><tr>
<td>ISSET_ISEMPTY_DIM_OBJ</td>
<td>check wether a variable is setted by its index and store the result.</td>
<td>ISSET_ISEMPTY_DIM_OBJ $a 0 ~0<br>
isset($a[0]);</td>
</tr><tr>
<td>ZEND_SEND_VAL_EX</td>
<td></td>
<td>Could see SEND_VAL_EX part.</td>
</tr><tr>
<td>ZEND_SEND_VAR</td>
<td></td>
<td>Could see SEND_VAR part.</td>
</tr><tr>
<td>ZEND_INIT_USER_CALL</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_SEND_ARRAY</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_SEND_USER</td>
<td></td>
<td></td>
</tr><tr>
<td>STRLEN</td>
<td>get length of string and store the result</td>
<td>STRLEN $a<BR>strlen($a);</td>
</tr><tr>
<td>DEFINED</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_TYPE_CHECK</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_VERIFY_RETURN_TYPE</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_FE_RESET_RW</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_FE_FETCH_RW</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_FE_FREE</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_INIT_DYNAMIC_CALL</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_DO_ICALL</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_DO_UCALL</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_DO_FCALL_BY_NAME</td>
<td></td>
<td></td>
</tr><tr>
<td>PRE_INC_OBJ</td>
<td>Same as PRE_INC but operate to an object</td>
<td>PRE_INC_OBJ $obj "a"<br>
++$obj->a;</td>
</tr><tr>
<td>PRE_DEC_OBJ</td>
<td>Same as PRE_DEC but operate to an object</td>
<td>PRE_DEC_OBJ $obj "a"<br>--$obj->a;</td>
</tr><tr>
<td>POST_INC_OBJ</td>
<td>Same as POST_INC but operate to an object</td>
<td>POST_INC_OBJ $obj "a" ~0<br>
$obj->a++;</td>
</tr><tr>
<td>POST_DEC_OBJ</td>
<td>Same as POST_DEC but operate to an object</td>
<td>POST_DEC_OBJ $obj "a" ~0<br>
$obj->a--;</td>
</tr><tr>
<td>ASSIGN_OBJ</td>
<td>fetch an object and wait for OP_DATA opcode.</td>
<td>ASSIGN_OBJ $obj "a"<br>
OP_DATA $t<br><br>
$obj->a=$t;</td>
</tr><tr>
<td>INSTANCEOF</td>
<td></td>
<td>INSTANCEOF $a "A" ~0<br>
$a instanceof A;</td>
</tr><tr>
<td>DECLARE_CLASS</td>
<td>declare a class by name</td>
<td>JMPZ true JX<br>
DECLARE_CLASS "a" @0<br><br>
if(true){class A{}}</td>
</tr><tr>
<td>DECLARE_INHERITED_CLASS</td>
<td>when declare a class by name,if declared class extends other class,will execute this opcode.</td>
<td>JMPZ true JX<br>
DECLARE_INHERITED_CLASS "a" "C" @0<br><br>
if(true){<br>
class a extends C{}<br>}</td>
</tr><tr>
<td>DECLARE_FUNCTION</td>
<td>declare function by name</td>
<td>JMPZ true JX<br>
DECLARE_FUNCTION "test"<br><br>
if(true){<br>
function test(){}<br>
}</td>
</tr><tr>
<td>RAISE_ABSTRACT_ERROR</td>
<td></td>
<td></td>
</tr><tr>
<td>DECLARE_CONST</td>
<td>declare a const value</td>
<td>DECLARE_CONST "a" 1<BR>
const a=1;</td>
</tr><tr>
<td>ADD_INTERFACE</td>
<td>when declare class by name,if declared class implements other interface,will execute this opcode.</td>
<td>JMPZ true JX<br>
DECLARE_CLASS "a" @0<br>
ADD_INTERFACE @0 "C"<br>
VERIFY_ABSTRACT_CLASS @0<br><br>
if(true){<br>
class a implements C{}<br>}</td>
</tr><tr>
<td>DECLARE_INHERITED_CLASS_DELAYED</td>
<td></td>
<td></td>
</tr><tr>
<td>VERIFY_ABSTRACT_CLASS</td>
<td></td>
<td>Could see ADD_INTERFACE part.</td>
</tr><tr>
<td>ASSIGN_DIM</td>
<td>set value of variable by index,followed by OP_DATA.</td>
<td>ASSIGN_DIM $x 0<br>
OP_DATA 2<br><br>
$x[0]=2;</td>
</tr><tr>
<td>OP_DATA</td>
<td>set value after "ASSIGN" opcodes(such as ASSIGN_DIM,ASSIGN_OBJ...) executed.</td>
<td>Could see ASSIGN_DIM part.</td>
</tr><tr>
<td>ISSET_ISEMPTY_PROP_OBJ</td>
<td>check wether a property value of an object is setted and store the result</td>
<td>ISSET_ISEMPTY_PROP_OBJ $a "b" ~0<br>
isset($a->b);</td>
</tr><tr>
<td>HANDLE_EXCEPTION</td>
<td></td>
<td></td>
</tr><tr>
<td>USER_OPCODE</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_ASSERT_CHECK</td>
<td></td>
<td></td>
</tr><tr>
<td>JMP_SET</td>
<td>set the variable if value is not zero,otherwise jump to address</td>
<td>JMP_SET $b JX ~0<br>
QM_ASSIGN 2 ~0<br>
ASSIGN $t ~0<br><br>
$t=$b?:2;</td>
</tr><tr>
<td>DECLARE_LAMBDA_FUNCTION</td>
<td></td>
<td>DECLARE_LAMBDA_FUNCTION "\000{clousre}C:\\"+ ~0<br>
INIT_DYNAMIC_CALL ~0<BR>
DO_FCALL<br><br>
(function(){return "phpinfo";})();</td>
</tr><tr>
<td>ADD_TRAIT</td>
<td>followed by BIND_TRAITS</td>
<td>DECLARE_CLASS "a" @0<br>
ADD_TRAIT @0 "B"<br>
BIND_TRAITS @0<br><br>
class A{<br>
use B;<br>
}</td>
</tr><tr>
<td>BIND_TRAITS</td>
<td>bind trait in class.</td>
<td>Could see ADD_TRAIT part.</td>
</tr><tr>
<td>ZEND_SEPARATE</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_FETCH_CLASS_NAME</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_CALL_TRAMPOLINE</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_DISCARD_EXCEPTION</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_YIELD</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_GENERATOR_RETURN</td>
<td></td>
<td></td>
</tr><tr>
<td>ZEND_FAST_CALL</td>
<td></td>