3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['01/01/2016' , '05/05/2016'], ['01/07/2017' , '31/07/2017'], ['01/07/2017' , '01/08/2017'], ['01/07/2017' , '02/08/2017'] ]; foreach ($array as $row) { $start = DateTime::createFromFormat('d/m/Y' , $row[0]); $end = DateTime::createFromFormat('d/m/Y' , $row[1]); $diff = $start->diff($end); printf( "De %s até %s há %d dias.\n", $row[0], $row[1], ($diff->format('%m') * 30) + $diff->format('%d') ); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 36
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 36
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/PSG5D
function name:  (null)
number of ops:  38
compiled vars:  !0 = $array, !1 = $row, !2 = $start, !3 = $end, !4 = $diff
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1      > FE_RESET_R                                       $6      !0, ->36
          2    > > FE_FETCH_R                                               $6, !1, ->36
   12     3    >   INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          4        SEND_VAL                                                 'd%2Fm%2FY'
          5        FETCH_DIM_R                                      ~7      !1, 0
          6        SEND_VAL                                                 ~7
          7        DO_FCALL                                      0  $8      
          8        ASSIGN                                                   !2, $8
   13     9        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
         10        SEND_VAL                                                 'd%2Fm%2FY'
         11        FETCH_DIM_R                                      ~10     !1, 1
         12        SEND_VAL                                                 ~10
         13        DO_FCALL                                      0  $11     
         14        ASSIGN                                                   !3, $11
   15    15        INIT_METHOD_CALL                                         !2, 'diff'
         16        SEND_VAR_EX                                              !3
         17        DO_FCALL                                      0  $13     
         18        ASSIGN                                                   !4, $13
   17    19        INIT_FCALL                                               'printf'
   18    20        SEND_VAL                                                 'De+%25s+at%C3%A9+%25s+h%C3%A1+%25d+dias.%0A'
   19    21        FETCH_DIM_R                                      ~15     !1, 0
         22        SEND_VAL                                                 ~15
   20    23        FETCH_DIM_R                                      ~16     !1, 1
         24        SEND_VAL                                                 ~16
   21    25        INIT_METHOD_CALL                                         !4, 'format'
         26        SEND_VAL_EX                                              '%25m'
         27        DO_FCALL                                      0  $17     
         28        MUL                                              ~18     $17, 30
         29        INIT_METHOD_CALL                                         !4, 'format'
         30        SEND_VAL_EX                                              '%25d'
         31        DO_FCALL                                      0  $19     
         32        ADD                                              ~20     ~18, $19
         33        SEND_VAL                                                 ~20
         34        DO_ICALL                                                 
   10    35      > JMP                                                      ->2
         36    >   FE_FREE                                                  $6
   23    37      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.12 ms | 1401 KiB | 15 Q