3v4l.org

run code in 300+ PHP versions simultaneously
<?php $markup = <<<XML <root> <label name="Pippo"></label> <label name="Caio"></label> <label name="Sempronio"></label> </root> XML; $xml = new SimpleXMLElement($markup); $elements = $xml->xpath('/root/label//@name'); $names = array_map(fn(SimpleXMLElement $element) => (string) $element, $elements); print_r($names);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kEvLf
function name:  (null)
number of ops:  19
compiled vars:  !0 = $markup, !1 = $xml, !2 = $elements, !3 = $names
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Croot%3E%0A++%3Clabel+name%3D%22Pippo%22%3E%3C%2Flabel%3E%0A++%3Clabel+name%3D%22Caio%22%3E%3C%2Flabel%3E%0A++%3Clabel+name%3D%22Sempronio%22%3E%3C%2Flabel%3E%0A%3C%2Froot%3E'
   11     1        NEW                                              $5      'SimpleXMLElement'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $5
   13     5        INIT_METHOD_CALL                                         !1, 'xpath'
          6        SEND_VAL_EX                                              '%2Froot%2Flabel%2F%2F%40name'
          7        DO_FCALL                                      0  $8      
          8        ASSIGN                                                   !2, $8
   14     9        INIT_FCALL                                               'array_map'
         10        DECLARE_LAMBDA_FUNCTION                          ~10     [0]
         11        SEND_VAL                                                 ~10
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $11     
         14        ASSIGN                                                   !3, $11
   16    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                                 
         18      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kEvLf
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $element
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        CAST                                          6  ~1      !0
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.35 ms | 1001 KiB | 15 Q