3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Enter your code here, enjoy! $firstDayInMonth = new DateTime("first day of this month"); $lastDayInMonth = new DateTime("last day of this month"); $currentDate = new DateTime(); $registryCollection = []; /* Better way */ $registryCollection = unserialize(""); // file_get_contents.. warning about "" // 2|1. User add in current day something: - Check if something is there ! array_key_exists! $registryCollection[$currentDate->format("d.m.Y")] = 120.0; // Test for another day; $otherDay = clone $currentDate; $otherDay->modify("-7 day"); $registryCollection[$otherDay->format("d.m.Y")] = (float)rand()%199; // Sort Array by keys ksort($registryCollection); // 1. User want to see all data stored: foreach($registryCollection as $date => $money){ echo "For date: {$date} you spent: {$money} PLN\n"; } // Sum all $sum = array_sum($registryCollection); echo "\nSUM: {$sum} PLN\n"; // We want to store data.. $data = serialize($registryCollection); // file_put_contents with content -> //print_r($data);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 39, Position 2 = 48
Branch analysis from position: 39
2 jumps found. (Code = 78) Position 1 = 40, Position 2 = 48
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
filename:       /in/Srek2
function name:  (null)
number of ops:  62
compiled vars:  !0 = $firstDayInMonth, !1 = $lastDayInMonth, !2 = $currentDate, !3 = $registryCollection, !4 = $otherDay, !5 = $money, !6 = $date, !7 = $sum, !8 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $9      'DateTime'
          1        SEND_VAL_EX                                              'first+day+of+this+month'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $9
    4     4        NEW                                              $12     'DateTime'
          5        SEND_VAL_EX                                              'last+day+of+this+month'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $12
    5     8        NEW                                              $15     'DateTime'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $15
    6    11        ASSIGN                                                   !3, <array>
   12    12        INIT_FCALL                                               'unserialize'
         13        SEND_VAL                                                 ''
         14        DO_ICALL                                         $19     
         15        ASSIGN                                                   !3, $19
   17    16        INIT_METHOD_CALL                                         !2, 'format'
         17        SEND_VAL_EX                                              'd.m.Y'
         18        DO_FCALL                                      0  $21     
         19        ASSIGN_DIM                                               !3, $21
         20        OP_DATA                                                  120
   22    21        CLONE                                            ~23     !2
         22        ASSIGN                                                   !4, ~23
   23    23        INIT_METHOD_CALL                                         !4, 'modify'
         24        SEND_VAL_EX                                              '-7+day'
         25        DO_FCALL                                      0          
   24    26        INIT_METHOD_CALL                                         !4, 'format'
         27        SEND_VAL_EX                                              'd.m.Y'
         28        DO_FCALL                                      0  $26     
         29        INIT_FCALL                                               'rand'
         30        DO_ICALL                                         $28     
         31        CAST                                          5  ~29     $28
         32        MOD                                              ~30     ~29, 199
         33        ASSIGN_DIM                                               !3, $26
         34        OP_DATA                                                  ~30
   27    35        INIT_FCALL                                               'ksort'
         36        SEND_REF                                                 !3
         37        DO_ICALL                                                 
   32    38      > FE_RESET_R                                       $32     !3, ->48
         39    > > FE_FETCH_R                                       ~33     $32, !5, ->48
         40    >   ASSIGN                                                   !6, ~33
   33    41        ROPE_INIT                                     5  ~36     'For+date%3A+'
         42        ROPE_ADD                                      1  ~36     ~36, !6
         43        ROPE_ADD                                      2  ~36     ~36, '+you+spent%3A+'
         44        ROPE_ADD                                      3  ~36     ~36, !5
         45        ROPE_END                                      4  ~35     ~36, '+PLN%0A'
         46        ECHO                                                     ~35
   32    47      > JMP                                                      ->39
         48    >   FE_FREE                                                  $32
   38    49        INIT_FCALL                                               'array_sum'
         50        SEND_VAR                                                 !3
         51        DO_ICALL                                         $39     
         52        ASSIGN                                                   !7, $39
   39    53        ROPE_INIT                                     3  ~42     '%0ASUM%3A+'
         54        ROPE_ADD                                      1  ~42     ~42, !7
         55        ROPE_END                                      2  ~41     ~42, '+PLN%0A'
         56        ECHO                                                     ~41
   44    57        INIT_FCALL                                               'serialize'
         58        SEND_VAR                                                 !3
         59        DO_ICALL                                         $44     
         60        ASSIGN                                                   !8, $44
   45    61      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
128.15 ms | 1405 KiB | 23 Q