3v4l.org

run code in 300+ PHP versions simultaneously
<?php function is_kosher($data, $colonne, $pos, $id_compte, $verbose=false) {//$type_data, $pos, $default=false) { global $tabTVA; global $tabEtat; $default_value = false; switch($colonne['data_type']) { case 'string': if(empty($data) === true) { $data = false; } $default_value = ''; break; case 'integer': //$data = filter_var($data, FILTER_VALIDATE_INT); if(ctype_digit($data) === false && is_int($data) === false) { $data = false; } $default_value = 0; break; case 'decimal': //$data = filter_var($data, FILTER_VALIDATE_FLOAT); if(is_numeric($data) === false) { $data = false; } $default_value = 0; break; case 'decimal.5': $data = str_replace(",",".",$data); //$data = filter_var($data, FILTER_VALIDATE_FLOAT); if(is_numeric($data) === false) { $data = false; } if($data !== false) { $data = number_format(round($data,5), 5, '.', ''); } $default_value = 0; break; case 'datetime': if(empty($data) === false) { $datetime = explode('/',$data); if(count($datetime) == 3) { $data = date('Y-m-d H:i:s', strtotime($datetime[2].'/'.$datetime[1].'/'.$datetime[0])); } else { $data = false; } } else { $data = false; } $default_value = "0000-00-00 00:00:00"; break; case 'ean': //id_compte 14 : Pieces Auto Tuning n'a pas d'EAN if($id_compte != 14 && (strlen($data) != 13 || substr($data, -6) == '000000')) { $data = false; } $default_value = 0; break; case 'boolean': if(($data === '0' || $data === '1') === false) { $data = false; } //$data = filter_var($data, FILTER_VALIDATE_BOOLEAN); $default_value = 0; break; case 'boolean_true': //echo 'boolean true #'.$data.'# -- *'.($data === '0' || $data === '1').'* -- *'.(($data === '0' || $data === '1') === false).'* -- *'.($data === false).'* '.gettype($data).'<br/>'; if(($data === '0' || $data === '1') === false) { $data = false; } //$data = filter_var($data, FILTER_VALIDATE_BOOLEAN); $default_value = 1; break; case 'tva': if(in_array($data, $tabTVA) === false) { $data = false; } $default_value = 20; //TVA a 20% par defaut break; case 'etat_produit': if(in_array($data, $tabEtat) === false) { $data = false; } $default_value = 1; //Etat neuf par defaut break; } $data = get_default($data, $colonne, $pos, $default_value ); //echo $data."\r\n"; return $data; } function get_default($data, $colonne, $pos, $default_value) { if($data === false && $colonne['default'] === true && $default_value !== false) { $data = $default_value; //set_erreur($colonne, $pos); } return $data; } echo is_kosher('a', array('data_type'=>'decimal.5','default'=>0), 0, 1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d25X6
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  103     0  E >   INIT_FCALL                                               'is_kosher'
          1        SEND_VAL                                                 'a'
          2        SEND_VAL                                                 <array>
          3        SEND_VAL                                                 0
          4        SEND_VAL                                                 1
          5        DO_FCALL                                      0  $0      
          6        ECHO                                                     $0
          7      > RETURN                                                   1

Function is_kosher:
Finding entry points
Branch analysis from position: 0
12 jumps found. (Code = 188) Position 1 = 31, Position 2 = 37, Position 3 = 49, Position 4 = 57, Position 5 = 84, Position 6 = 116, Position 7 = 132, Position 8 = 141, Position 9 = 150, Position 10 = 159, Position 11 = 168, Position 12 = 10
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 35
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 168
Branch analysis from position: 168
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
Branch analysis from position: 37
2 jumps found. (Code = 46) Position 1 = 42, Position 2 = 45
Branch analysis from position: 42
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 47
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 168
Branch analysis from position: 168
Branch analysis from position: 47
Branch analysis from position: 45
Branch analysis from position: 49
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 55
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 168
Branch analysis from position: 168
Branch analysis from position: 55
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 68, Position 2 = 69
Branch analysis from position: 68
2 jumps found. (Code = 43) Position 1 = 71, Position 2 = 82
Branch analysis from position: 71
1 jumps found. (Code = 42) Position 1 = 168
Branch analysis from position: 168
Branch analysis from position: 82
Branch analysis from position: 69
Branch analysis from position: 84
2 jumps found. (Code = 43) Position 1 = 87, Position 2 = 113
Branch analysis from position: 87
2 jumps found. (Code = 43) Position 1 = 95, Position 2 = 111
Branch analysis from position: 95
1 jumps found. (Code = 42) Position 1 = 112
Branch analysis from position: 112
1 jumps found. (Code = 42) Position 1 = 114
Branch analysis from position: 114
1 jumps found. (Code = 42) Position 1 = 168
Branch analysis from position: 168
Branch analysis from position: 111
1 jumps found. (Code = 42) Position 1 = 114
Branch analysis from position: 114
Branch analysis from position: 113
1 jumps found. (Code = 42) Position 1 = 168
Branch analysis from position: 168
Branch analysis from position: 116
2 jumps found. (Code = 46) Position 1 = 118, Position 2 = 128
Branch analysis from position: 118
2 jumps found. (Code = 47) Position 1 = 121, Position 2 = 127
Branch analysis from position: 121
2 jumps found. (Code = 43) Position 1 = 129, Position 2 = 130
Branch analysis from position: 129
1 jumps found. (Code = 42) Position 1 = 168
Branch analysis from position: 168
Branch analysis from position: 130
Branch analysis from position: 127
Branch analysis from position: 128
Branch analysis from position: 132
2 jumps found. (Code = 47) Position 1 = 134, Position 2 = 136
Branch analysis from position: 134
2 jumps found. (Code = 43) Position 1 = 138, Position 2 = 139
Branch analysis from position: 138
1 jumps found. (Code = 42) Position 1 = 168
Branch analysis from position: 168
Branch analysis from position: 139
Branch analysis from position: 136
Branch analysis from position: 141
2 jumps found. (Code = 47) Position 1 = 143, Position 2 = 145
Branch analysis from position: 143
2 jumps found. (Code = 43) Position 1 = 147, Position 2 = 148
Branch analysis from position: 147
1 jumps found. (Code = 42) Position 1 = 168
Branch analysis from position: 168
Branch analysis from position: 148
Branch analysis from position: 145
Branch analysis from position: 150
2 jumps found. (Code = 43) Position 1 = 156, Position 2 = 157
Branch analysis from position: 156
1 jumps found. (Code = 42) Position 1 = 168
Branch analysis from position: 168
Branch analysis from position: 157
Branch analysis from position: 159
2 jumps found. (Code = 43) Position 1 = 165, Position 2 = 166
Branch analysis from position: 165
1 jumps found. (Code = 42) Position 1 = 168
Branch analysis from position: 168
Branch analysis from position: 166
Branch analysis from position: 168
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 31
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 37
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 49
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 57
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 84
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 116
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 132
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 141
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 150
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 159
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 168
Branch analysis from position: 168
Branch analysis from position: 159
Branch analysis from position: 150
Branch analysis from position: 141
Branch analysis from position: 132
Branch analysis from position: 116
Branch analysis from position: 84
Branch analysis from position: 57
Branch analysis from position: 49
Branch analysis from position: 37
Branch analysis from position: 31
filename:       /in/d25X6
function name:  is_kosher
number of ops:  178
compiled vars:  !0 = $data, !1 = $colonne, !2 = $pos, !3 = $id_compte, !4 = $verbose, !5 = $tabTVA, !6 = $tabEtat, !7 = $default_value, !8 = $datetime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV_INIT                                        !4      <false>
    3     5        BIND_GLOBAL                                              !5, 'tabTVA'
    4     6        BIND_GLOBAL                                              !6, 'tabEtat'
    5     7        ASSIGN                                                   !7, <false>
    6     8        FETCH_DIM_R                                      ~10     !1, 'data_type'
          9      > SWITCH_STRING                                            ~10, [ 'string':->31, 'integer':->37, 'decimal':->49, 'decimal.5':->57, 'datetime':->84, 'ean':->116, 'boolean':->132, 'boolean_true':->141, 'tva':->150, 'etat_produit':->159, ], ->168
    7    10    >   CASE                                                     ~10, 'string'
         11      > JMPNZ                                                    ~11, ->31
   13    12    >   CASE                                                     ~10, 'integer'
         13      > JMPNZ                                                    ~11, ->37
   20    14    >   CASE                                                     ~10, 'decimal'
         15      > JMPNZ                                                    ~11, ->49
   27    16    >   CASE                                                     ~10, 'decimal.5'
         17      > JMPNZ                                                    ~11, ->57
   38    18    >   CASE                                                     ~10, 'datetime'
         19      > JMPNZ                                                    ~11, ->84
   53    20    >   CASE                                                     ~10, 'ean'
         21      > JMPNZ                                                    ~11, ->116
   60    22    >   CASE                                                     ~10, 'boolean'
         23      > JMPNZ                                                    ~11, ->132
   68    24    >   CASE                                                     ~10, 'boolean_true'
         25      > JMPNZ                                                    ~11, ->141
   77    26    >   CASE                                                     ~10, 'tva'
         27      > JMPNZ                                                    ~11, ->150
   83    28    >   CASE                                                     ~10, 'etat_produit'
         29      > JMPNZ                                                    ~11, ->159
         30    > > JMP                                                      ->168
    8    31    >   ISSET_ISEMPTY_CV                                 ~12     !0
         32        TYPE_CHECK                                    8          ~12
         33      > JMPZ                                                     ~13, ->35
    9    34    >   ASSIGN                                                   !0, <false>
   11    35    >   ASSIGN                                                   !7, ''
   12    36      > JMP                                                      ->168
   15    37    >   INIT_FCALL                                               'ctype_digit'
         38        SEND_VAR                                                 !0
         39        DO_ICALL                                         $16     
         40        TYPE_CHECK                                    4  ~17     $16
         41      > JMPZ_EX                                          ~17     ~17, ->45
         42    >   TYPE_CHECK                                   16  ~18     !0
         43        TYPE_CHECK                                    4  ~19     ~18
         44        BOOL                                             ~17     ~19
         45    > > JMPZ                                                     ~17, ->47
   16    46    >   ASSIGN                                                   !0, <false>
   18    47    >   ASSIGN                                                   !7, 0
   19    48      > JMP                                                      ->168
   22    49    >   INIT_FCALL                                               'is_numeric'
         50        SEND_VAR                                                 !0
         51        DO_ICALL                                         $22     
         52        TYPE_CHECK                                    4          $22
         53      > JMPZ                                                     ~23, ->55
   23    54    >   ASSIGN                                                   !0, <false>
   25    55    >   ASSIGN                                                   !7, 0
   26    56      > JMP                                                      ->168
   28    57    >   INIT_FCALL                                               'str_replace'
         58        SEND_VAL                                                 '%2C'
         59        SEND_VAL                                                 '.'
         60        SEND_VAR                                                 !0
         61        DO_ICALL                                         $26     
         62        ASSIGN                                                   !0, $26
   30    63        INIT_FCALL                                               'is_numeric'
         64        SEND_VAR                                                 !0
         65        DO_ICALL                                         $28     
         66        TYPE_CHECK                                    4          $28
         67      > JMPZ                                                     ~29, ->69
   31    68    >   ASSIGN                                                   !0, <false>
   33    69    >   TYPE_CHECK                                  1018          !0
         70      > JMPZ                                                     ~31, ->82
   34    71    >   INIT_FCALL                                               'number_format'
         72        INIT_FCALL                                               'round'
         73        SEND_VAR                                                 !0
         74        SEND_VAL                                                 5
         75        DO_ICALL                                         $32     
         76        SEND_VAR                                                 $32
         77        SEND_VAL                                                 5
         78        SEND_VAL                                                 '.'
         79        SEND_VAL                                                 ''
         80        DO_ICALL                                         $33     
         81        ASSIGN                                                   !0, $33
   36    82    >   ASSIGN                                                   !7, 0
   37    83      > JMP                                                      ->168
   39    84    >   ISSET_ISEMPTY_CV                                 ~36     !0
         85        TYPE_CHECK                                    4          ~36
         86      > JMPZ                                                     ~37, ->113
   40    87    >   INIT_FCALL                                               'explode'
         88        SEND_VAL                                                 '%2F'
         89        SEND_VAR                                                 !0
         90        DO_ICALL                                         $38     
         91        ASSIGN                                                   !8, $38
   41    92        COUNT                                            ~40     !8
         93        IS_EQUAL                                                 ~40, 3
         94      > JMPZ                                                     ~41, ->111
   42    95    >   INIT_FCALL                                               'date'
         96        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
         97        INIT_FCALL                                               'strtotime'
         98        FETCH_DIM_R                                      ~42     !8, 2
         99        CONCAT                                           ~43     ~42, '%2F'
        100        FETCH_DIM_R                                      ~44     !8, 1
        101        CONCAT                                           ~45     ~43, ~44
        102        CONCAT                                           ~46     ~45, '%2F'
        103        FETCH_DIM_R                                      ~47     !8, 0
        104        CONCAT                                           ~48     ~46, ~47
        105        SEND_VAL                                                 ~48
        106        DO_ICALL                                         $49     
        107        SEND_VAR                                                 $49
        108        DO_ICALL                                         $50     
        109        ASSIGN                                                   !0, $50
        110      > JMP                                                      ->112
   45   111    >   ASSIGN                                                   !0, <false>
        112    > > JMP                                                      ->114
   49   113    >   ASSIGN                                                   !0, <false>
   51   114    >   ASSIGN                                                   !7, '0000-00-00+00%3A00%3A00'
   52   115      > JMP                                                      ->168
   55   116    >   IS_NOT_EQUAL                                     ~55     !3, 14
        117      > JMPZ_EX                                          ~55     ~55, ->128
        118    >   STRLEN                                           ~56     !0
        119        IS_NOT_EQUAL                                     ~57     ~56, 13
        120      > JMPNZ_EX                                         ~57     ~57, ->127
        121    >   INIT_FCALL                                               'substr'
        122        SEND_VAR                                                 !0
        123        SEND_VAL                                                 -6
        124        DO_ICALL                                         $58     
        125        IS_EQUAL                                         ~59     $58, '000000'
        126        BOOL                                             ~57     ~59
        127    >   BOOL                                             ~55     ~57
        128    > > JMPZ                                                     ~55, ->130
   56   129    >   ASSIGN                                                   !0, <false>
   58   130    >   ASSIGN                                                   !7, 0
   59   131      > JMP                                                      ->168
   61   132    >   IS_IDENTICAL                                     ~62     !0, '0'
        133      > JMPNZ_EX                                         ~62     ~62, ->136
        134    >   IS_IDENTICAL                                     ~63     !0, '1'
        135        BOOL                                             ~62     ~63
        136    >   TYPE_CHECK                                    4          ~62
        137      > JMPZ                                                     ~64, ->139
   62   138    >   ASSIGN                                                   !0, <false>
   66   139    >   ASSIGN                                                   !7, 0
   67   140      > JMP                                                      ->168
   70   141    >   IS_IDENTICAL                                     ~67     !0, '0'
        142      > JMPNZ_EX                                         ~67     ~67, ->145
        143    >   IS_IDENTICAL                                     ~68     !0, '1'
        144        BOOL                                             ~67     ~68
        145    >   TYPE_CHECK                                    4          ~67
        146      > JMPZ                                                     ~69, ->148
   71   147    >   ASSIGN                                                   !0, <false>
   75   148    >   ASSIGN                                                   !7, 1
   76   149      > JMP                                                      ->168
   78   150    >   INIT_FCALL                                               'in_array'
        151        SEND_VAR                                                 !0
        152        SEND_VAR                                                 !5
        153        DO_ICALL                                         $72     
        154        TYPE_CHECK                                    4          $72
        155      > JMPZ                                                     ~73, ->157
   79   156    >   ASSIGN                                                   !0, <false>
   81   157    >   ASSIGN                                                   !7, 20
   82   158      > JMP                                                      ->168
   84   159    >   INIT_FCALL                                               'in_array'
        160        SEND_VAR                                                 !0
        161        SEND_VAR                                                 !6
        162        DO_ICALL                                         $76     
        163        TYPE_CHECK                                    4          $76
        164      > JMPZ                                                     ~77, ->166
   85   165    >   ASSIGN                                                   !0, <false>
   87   166    >   ASSIGN                                                   !7, 1
   88   167      > JMP                                                      ->168
        168    >   FREE                                                     ~10
   90   169        INIT_FCALL_BY_NAME                                       'get_default'
        170        SEND_VAR_EX                                              !0
        171        SEND_VAR_EX                                              !1
        172        SEND_VAR_EX                                              !2
        173        SEND_VAR_EX                                              !7
        174        DO_FCALL                                      0  $80     
        175        ASSIGN                                                   !0, $80
   92   176      > RETURN                                                   !0
   93   177*     > RETURN                                                   null

End of function is_kosher

Function get_default:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
2 jumps found. (Code = 46) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
Branch analysis from position: 12
Branch analysis from position: 9
filename:       /in/d25X6
function name:  get_default
number of ops:  16
compiled vars:  !0 = $data, !1 = $colonne, !2 = $pos, !3 = $default_value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   95     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   96     4        TYPE_CHECK                                    4  ~4      !0
          5      > JMPZ_EX                                          ~4      ~4, ->9
          6    >   FETCH_DIM_R                                      ~5      !1, 'default'
          7        TYPE_CHECK                                    8  ~6      ~5
          8        BOOL                                             ~4      ~6
          9    > > JMPZ_EX                                          ~4      ~4, ->12
         10    >   TYPE_CHECK                                  1018  ~7      !3
         11        BOOL                                             ~4      ~7
         12    > > JMPZ                                                     ~4, ->14
   97    13    >   ASSIGN                                                   !0, !3
  100    14    > > RETURN                                                   !0
  101    15*     > RETURN                                                   null

End of function get_default

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.31 ms | 1410 KiB | 34 Q