3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array("2017-06-30-18-21-52 foo.txt"); $array[] = "2017-07-01-19-06-21 bar bar.txt"; foreach ($array as $v) { $v = rtrim($v, ".txt"); $boom = explode(" ", $v); // Separate the date $date = DateTime::createFromFormat("Y-m-d-H-i-s", $boom[0]); unset($boom[0]); // Unset the date $text = implode(" ", $boom); echo $text." -- ".$date->format("F jS, Y")."\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 35
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 35
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/X6L6Y
function name:  (null)
number of ops:  37
compiled vars:  !0 = $array, !1 = $v, !2 = $boom, !3 = $date, !4 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN_DIM                                               !0
          2        OP_DATA                                                  '2017-07-01-19-06-21+bar+bar.txt'
    6     3      > FE_RESET_R                                       $7      !0, ->35
          4    > > FE_FETCH_R                                               $7, !1, ->35
    7     5    >   INIT_FCALL                                               'rtrim'
          6        SEND_VAR                                                 !1
          7        SEND_VAL                                                 '.txt'
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !1, $8
    8    10        INIT_FCALL                                               'explode'
         11        SEND_VAL                                                 '+'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !2, $10
    9    15        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
         16        SEND_VAL                                                 'Y-m-d-H-i-s'
         17        FETCH_DIM_R                                      ~12     !2, 0
         18        SEND_VAL                                                 ~12
         19        DO_FCALL                                      0  $13     
         20        ASSIGN                                                   !3, $13
   10    21        UNSET_DIM                                                !2, 0
   11    22        INIT_FCALL                                               'implode'
         23        SEND_VAL                                                 '+'
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                         $15     
         26        ASSIGN                                                   !4, $15
   13    27        CONCAT                                           ~17     !4, '+--+'
         28        INIT_METHOD_CALL                                         !3, 'format'
         29        SEND_VAL_EX                                              'F+jS%2C+Y'
         30        DO_FCALL                                      0  $18     
         31        CONCAT                                           ~19     ~17, $18
         32        CONCAT                                           ~20     ~19, '%0A'
         33        ECHO                                                     ~20
    6    34      > JMP                                                      ->4
         35    >   FE_FREE                                                  $7
   14    36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.51 ms | 1396 KiB | 19 Q