3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyDateTime extends DateTime { public function setTimestamp( $timestamp ) { $date = getdate( ( int ) $timestamp ); $this->setDate( $date['year'] , $date['mon'] , $date['mday'] ); $this->setTime( $date['hours'] , $date['minutes'] , $date['seconds'] ); } public function getTimestamp() { return $this->format( 'U' ); } } $date = new MyDateTime(); $need_score = 248; $timestamp = 1417763475; $current_score = 0.7; $date_now = new DateTime(); $date = new MyDateTime(); $date->setTimestamp($timestamp); $interval_days = $date_now->diff($date)->days + 1; print ($need_score - $current_score) * $interval_days;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QgCar
function name:  (null)
number of ops:  25
compiled vars:  !0 = $date, !1 = $need_score, !2 = $timestamp, !3 = $current_score, !4 = $date_now, !5 = $interval_days
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $6      'MyDateTime'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $6
   20     3        ASSIGN                                                   !1, 248
   21     4        ASSIGN                                                   !2, 1417763475
   22     5        ASSIGN                                                   !3, 0.7
   24     6        NEW                                              $12     'DateTime'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !4, $12
   25     9        NEW                                              $15     'MyDateTime'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !0, $15
   26    12        INIT_METHOD_CALL                                         !0, 'setTimestamp'
         13        SEND_VAR_EX                                              !2
         14        DO_FCALL                                      0          
   27    15        INIT_METHOD_CALL                                         !4, 'diff'
         16        SEND_VAR_EX                                              !0
         17        DO_FCALL                                      0  $19     
         18        FETCH_OBJ_R                                      ~20     $19, 'days'
         19        ADD                                              ~21     ~20, 1
         20        ASSIGN                                                   !5, ~21
   29    21        SUB                                              ~23     !1, !3
         22        MUL                                              ~24     !5, ~23
         23        ECHO                                                     ~24
         24      > RETURN                                                   1

Class MyDateTime:
Function settimestamp:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QgCar
function name:  setTimestamp
number of ops:  29
compiled vars:  !0 = $timestamp, !1 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'getdate'
          2        CAST                                          4  ~2      !0
          3        SEND_VAL                                                 ~2
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
    8     6        INIT_METHOD_CALL                                         'setDate'
          7        CHECK_FUNC_ARG                                           
          8        FETCH_DIM_FUNC_ARG                               $5      !1, 'year'
          9        SEND_FUNC_ARG                                            $5
         10        CHECK_FUNC_ARG                                           
         11        FETCH_DIM_FUNC_ARG                               $6      !1, 'mon'
         12        SEND_FUNC_ARG                                            $6
         13        CHECK_FUNC_ARG                                           
         14        FETCH_DIM_FUNC_ARG                               $7      !1, 'mday'
         15        SEND_FUNC_ARG                                            $7
         16        DO_FCALL                                      0          
    9    17        INIT_METHOD_CALL                                         'setTime'
         18        CHECK_FUNC_ARG                                           
         19        FETCH_DIM_FUNC_ARG                               $9      !1, 'hours'
         20        SEND_FUNC_ARG                                            $9
         21        CHECK_FUNC_ARG                                           
         22        FETCH_DIM_FUNC_ARG                               $10     !1, 'minutes'
         23        SEND_FUNC_ARG                                            $10
         24        CHECK_FUNC_ARG                                           
         25        FETCH_DIM_FUNC_ARG                               $11     !1, 'seconds'
         26        SEND_FUNC_ARG                                            $11
         27        DO_FCALL                                      0          
   10    28      > RETURN                                                   null

End of function settimestamp

Function gettimestamp:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QgCar
function name:  getTimestamp
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_METHOD_CALL                                         'format'
          1        SEND_VAL_EX                                              'U'
          2        DO_FCALL                                      0  $0      
          3      > RETURN                                                   $0
   15     4*     > RETURN                                                   null

End of function gettimestamp

End of class MyDateTime.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.76 ms | 1400 KiB | 15 Q