3v4l.org

run code in 300+ PHP versions simultaneously
<?php define("STATE_ID","3"); define("DATA_CACHE_TIMEOUT","9999"); class ImportController extends Controller { public function actionIndex() { $t1=date("r"); $ts1=microtime(true); $tot=0; echo "\r\n<p> ******** Started at $t1 ******** </p>\r\n"; $connection = Yii::app()->db; $command = $connection->createCommand('SELECT * FROM seccsirsa LIMIT 0,10'); $rows = $command->queryAll(); //executes the SQL statement and returns the first row of the //$res = array(); foreach ($rows as $row) { extract($row); echo "\r\n<p>Full Name: $Name_en ($Name_h) </p>\r\n"; //echo "<br /> ".$this->getDistId($District."DEL"); echo "<br /> ".$this->getDistId($District); } $t2=date("r"); $ts2=microtime(true); $diff=($ts2-$ts1); echo "\r\n<p> ******** Stopped at $t2 ******** </p>\r\n"; echo "\r\n<p> ******** Total Execution Time: $diff microseconds ******** </p>\r\n"; echo "\r\n<p> ******** Total Records Imported: $tot ******** </p>\r\n"; } private function getDistId($District){ //Select if record exists $District=trim(strtolower($District)); $connection = Yii::app()->db; $connection->active=true; $command = $connection->createCommand("SELECT LR_ID FROM tblLandRegion WHERE lower(LR_Name) = '$District' AND LR_Type='District' "); $row = $command->queryRow(); //If no record found if($row===false){ //Insert record in DB (Master Table) $command = $connection->createCommand("INSERT INTO tblLandRegion (LR_Name,LR_Type) VALUES('$District', 'District') "); $rowCount=$command->execute(); if($rowCount==0){ die("FATAL ERROR 0x01: Failed to insert $District in Master table :: ".__FILE__." at line nunber ".__LINE__); } else{ //Cache and Return the PK/ID of the new inserted record. $row = Yii::app()->cache->get('cache_'.$District."_".STATE_ID); if (($row === false) || row($res)) { $District=trim(strtolower($District)); $connection = Yii::app()->db; $command = $connection->createCommand("SELECT LR_ID FROM tblLandRegion WHERE lower(LR_Name) = '$District' AND LR_Type='District' ORDER BY LR_ID DESC"); $row = $command->queryRow(); Yii::app()->cache->set('cache_'.$District."_".STATE_ID, $row, DATA_CACHE_TIMEOUT); } $District_ID=$row['LR_ID']; //Insert record in DB (Reference Table) $command = $connection->createCommand("INSERT INTO tblDistrict (District_ID, State_ID) VALUES('$District_ID', '".STATE_ID."') "); $rowCount=$command->execute(); if($rowCount==0){ die("FATAL ERROR 0x02: Failed to insert $District in Reference table :: ".__FILE__." at line nunber ".__LINE__); } return $District_ID; } } else{ //Return the PK/ID of the record. return $row['LR_ID']; } } } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9q9JV
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'define'
          1        SEND_VAL                                                 'STATE_ID'
          2        SEND_VAL                                                 '3'
          3        DO_ICALL                                                 
    3     4        INIT_FCALL                                               'define'
          5        SEND_VAL                                                 'DATA_CACHE_TIMEOUT'
          6        SEND_VAL                                                 '9999'
          7        DO_ICALL                                                 
    6     8        DECLARE_CLASS                                            'importcontroller', 'controller'
   75     9      > RETURN                                                   1

Class ImportController:
Function actionindex:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 41
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 41
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
filename:       /in/9q9JV
function name:  actionIndex
number of ops:  65
compiled vars:  !0 = $t1, !1 = $ts1, !2 = $tot, !3 = $connection, !4 = $command, !5 = $rows, !6 = $row, !7 = $Name_en, !8 = $Name_h, !9 = $District, !10 = $t2, !11 = $ts2, !12 = $diff
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'date'
          1        SEND_VAL                                                 'r'
          2        DO_ICALL                                         $13     
          3        ASSIGN                                                   !0, $13
   10     4        INIT_FCALL                                               'microtime'
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                         $15     
          7        ASSIGN                                                   !1, $15
   11     8        ASSIGN                                                   !2, 0
   12     9        ROPE_INIT                                     3  ~19     '%0D%0A%3Cp%3E+%2A%2A%2A%2A%2A%2A%2A%2A+Started+at++'
         10        ROPE_ADD                                      1  ~19     ~19, !0
         11        ROPE_END                                      2  ~18     ~19, '+%2A%2A%2A%2A%2A%2A%2A%2A+%3C%2Fp%3E%0D%0A'
         12        ECHO                                                     ~18
   14    13        INIT_STATIC_METHOD_CALL                                  'Yii', 'app'
         14        DO_FCALL                                      0  $21     
         15        FETCH_OBJ_R                                      ~22     $21, 'db'
         16        ASSIGN                                                   !3, ~22
   15    17        INIT_METHOD_CALL                                         !3, 'createCommand'
         18        SEND_VAL_EX                                              'SELECT+%2A+FROM+seccsirsa+LIMIT+0%2C10'
         19        DO_FCALL                                      0  $24     
         20        ASSIGN                                                   !4, $24
   16    21        INIT_METHOD_CALL                                         !4, 'queryAll'
         22        DO_FCALL                                      0  $26     
         23        ASSIGN                                                   !5, $26
   18    24      > FE_RESET_R                                       $28     !5, ->41
         25    > > FE_FETCH_R                                               $28, !6, ->41
   19    26    >   INIT_FCALL                                               'extract'
         27        SEND_REF                                                 !6
         28        DO_ICALL                                                 
   21    29        ROPE_INIT                                     5  ~31     '%0D%0A%3Cp%3EFull+Name%3A+'
         30        ROPE_ADD                                      1  ~31     ~31, !7
         31        ROPE_ADD                                      2  ~31     ~31, '+%28'
         32        ROPE_ADD                                      3  ~31     ~31, !8
         33        ROPE_END                                      4  ~30     ~31, '%29+%3C%2Fp%3E%0D%0A'
         34        ECHO                                                     ~30
   23    35        INIT_METHOD_CALL                                         'getDistId'
         36        SEND_VAR_EX                                              !9
         37        DO_FCALL                                      0  $34     
         38        CONCAT                                           ~35     '%3Cbr+%2F%3E+', $34
         39        ECHO                                                     ~35
   18    40      > JMP                                                      ->25
         41    >   FE_FREE                                                  $28
   26    42        INIT_FCALL                                               'date'
         43        SEND_VAL                                                 'r'
         44        DO_ICALL                                         $36     
         45        ASSIGN                                                   !10, $36
   27    46        INIT_FCALL                                               'microtime'
         47        SEND_VAL                                                 <true>
         48        DO_ICALL                                         $38     
         49        ASSIGN                                                   !11, $38
   28    50        SUB                                              ~40     !11, !1
         51        ASSIGN                                                   !12, ~40
   29    52        ROPE_INIT                                     3  ~43     '%0D%0A%3Cp%3E+%2A%2A%2A%2A%2A%2A%2A%2A+Stopped+at++'
         53        ROPE_ADD                                      1  ~43     ~43, !10
         54        ROPE_END                                      2  ~42     ~43, '+%2A%2A%2A%2A%2A%2A%2A%2A+%3C%2Fp%3E%0D%0A'
         55        ECHO                                                     ~42
   30    56        ROPE_INIT                                     3  ~46     '%0D%0A%3Cp%3E+%2A%2A%2A%2A%2A%2A%2A%2A+Total+Execution+Time%3A+'
         57        ROPE_ADD                                      1  ~46     ~46, !12
         58        ROPE_END                                      2  ~45     ~46, '+microseconds+%2A%2A%2A%2A%2A%2A%2A%2A+%3C%2Fp%3E%0D%0A'
         59        ECHO                                                     ~45
   31    60        ROPE_INIT                                     3  ~49     '%0D%0A%3Cp%3E+%2A%2A%2A%2A%2A%2A%2A%2A+Total+Records+Imported%3A+'
         61        ROPE_ADD                                      1  ~49     ~49, !2
         62        ROPE_END                                      2  ~48     ~49, '++%2A%2A%2A%2A%2A%2A%2A%2A+%3C%2Fp%3E%0D%0A'
         63        ECHO                                                     ~48
   32    64      > RETURN                                                   null

End of function actionindex

Function getdistid:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 124
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 46
Branch analysis from position: 38
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 46
2 jumps found. (Code = 47) Position 1 = 59, Position 2 = 63
Branch analysis from position: 59
2 jumps found. (Code = 43) Position 1 = 64, Position 2 = 98
Branch analysis from position: 64
2 jumps found. (Code = 43) Position 1 = 115, Position 2 = 122
Branch analysis from position: 115
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 122
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 98
Branch analysis from position: 63
Branch analysis from position: 124
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9q9JV
function name:  getDistId
number of ops:  127
compiled vars:  !0 = $District, !1 = $connection, !2 = $command, !3 = $row, !4 = $rowCount, !5 = $res, !6 = $District_ID
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   RECV                                             !0      
   36     1        INIT_FCALL                                               'trim'
          2        INIT_FCALL                                               'strtolower'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $7      
          5        SEND_VAR                                                 $7
          6        DO_ICALL                                         $8      
          7        ASSIGN                                                   !0, $8
   37     8        INIT_STATIC_METHOD_CALL                                  'Yii', 'app'
          9        DO_FCALL                                      0  $10     
         10        FETCH_OBJ_R                                      ~11     $10, 'db'
         11        ASSIGN                                                   !1, ~11
   38    12        ASSIGN_OBJ                                               !1, 'active'
         13        OP_DATA                                                  <true>
   39    14        INIT_METHOD_CALL                                         !1, 'createCommand'
         15        ROPE_INIT                                     3  ~15     'SELECT+LR_ID+FROM+tblLandRegion+WHERE+lower%28LR_Name%29+%3D+%27'
         16        ROPE_ADD                                      1  ~15     ~15, !0
         17        ROPE_END                                      2  ~14     ~15, '%27+AND+LR_Type%3D%27District%27+'
         18        SEND_VAL_EX                                              ~14
         19        DO_FCALL                                      0  $17     
         20        ASSIGN                                                   !2, $17
   40    21        INIT_METHOD_CALL                                         !2, 'queryRow'
         22        DO_FCALL                                      0  $19     
         23        ASSIGN                                                   !3, $19
   42    24        TYPE_CHECK                                    4          !3
         25      > JMPZ                                                     ~21, ->124
   44    26    >   INIT_METHOD_CALL                                         !1, 'createCommand'
         27        ROPE_INIT                                     3  ~23     'INSERT+INTO+tblLandRegion+%28LR_Name%2CLR_Type%29+VALUES%28%27'
         28        ROPE_ADD                                      1  ~23     ~23, !0
         29        ROPE_END                                      2  ~22     ~23, '%27%2C+%27District%27%29+'
         30        SEND_VAL_EX                                              ~22
         31        DO_FCALL                                      0  $25     
         32        ASSIGN                                                   !2, $25
   45    33        INIT_METHOD_CALL                                         !2, 'execute'
         34        DO_FCALL                                      0  $27     
         35        ASSIGN                                                   !4, $27
   46    36        IS_EQUAL                                                 !4, 0
         37      > JMPZ                                                     ~29, ->46
   47    38    >   ROPE_INIT                                     3  ~31     'FATAL+ERROR+0x01%3A+Failed+to+insert+'
         39        ROPE_ADD                                      1  ~31     ~31, !0
         40        ROPE_END                                      2  ~30     ~31, '+in+Master+table+%3A%3A+'
         41        CONCAT                                           ~33     ~30, '%2Fin%2F9q9JV'
         42        CONCAT                                           ~34     ~33, '+at+line+nunber+'
         43        CONCAT                                           ~35     ~34, '47'
         44      > EXIT                                                     ~35
         45*       JMP                                                      ->123
   51    46    >   INIT_STATIC_METHOD_CALL                                  'Yii', 'app'
         47        DO_FCALL                                      0  $36     
         48        FETCH_OBJ_R                                      ~37     $36, 'cache'
         49        INIT_METHOD_CALL                                         ~37, 'get'
         50        CONCAT                                           ~38     'cache_', !0
         51        CONCAT                                           ~39     ~38, '_'
         52        FETCH_CONSTANT                                   ~40     'STATE_ID'
         53        CONCAT                                           ~41     ~39, ~40
         54        SEND_VAL_EX                                              ~41
         55        DO_FCALL                                      0  $42     
         56        ASSIGN                                                   !3, $42
   52    57        TYPE_CHECK                                    4  ~44     !3
         58      > JMPNZ_EX                                         ~44     ~44, ->63
         59    >   INIT_FCALL_BY_NAME                                       'row'
         60        SEND_VAR_EX                                              !5
         61        DO_FCALL                                      0  $45     
         62        BOOL                                             ~44     $45
         63    > > JMPZ                                                     ~44, ->98
   53    64    >   INIT_FCALL                                               'trim'
         65        INIT_FCALL                                               'strtolower'
         66        SEND_VAR                                                 !0
         67        DO_ICALL                                         $46     
         68        SEND_VAR                                                 $46
         69        DO_ICALL                                         $47     
         70        ASSIGN                                                   !0, $47
   54    71        INIT_STATIC_METHOD_CALL                                  'Yii', 'app'
         72        DO_FCALL                                      0  $49     
         73        FETCH_OBJ_R                                      ~50     $49, 'db'
         74        ASSIGN                                                   !1, ~50
   55    75        INIT_METHOD_CALL                                         !1, 'createCommand'
         76        ROPE_INIT                                     3  ~53     'SELECT+LR_ID+FROM+tblLandRegion+WHERE+lower%28LR_Name%29+%3D+%27'
         77        ROPE_ADD                                      1  ~53     ~53, !0
         78        ROPE_END                                      2  ~52     ~53, '%27+AND+LR_Type%3D%27District%27+ORDER+BY+LR_ID+DESC'
         79        SEND_VAL_EX                                              ~52
         80        DO_FCALL                                      0  $55     
         81        ASSIGN                                                   !2, $55
   56    82        INIT_METHOD_CALL                                         !2, 'queryRow'
         83        DO_FCALL                                      0  $57     
         84        ASSIGN                                                   !3, $57
   57    85        INIT_STATIC_METHOD_CALL                                  'Yii', 'app'
         86        DO_FCALL                                      0  $59     
         87        FETCH_OBJ_R                                      ~60     $59, 'cache'
         88        INIT_METHOD_CALL                                         ~60, 'set'
         89        CONCAT                                           ~61     'cache_', !0
         90        CONCAT                                           ~62     ~61, '_'
         91        FETCH_CONSTANT                                   ~63     'STATE_ID'
         92        CONCAT                                           ~64     ~62, ~63
         93        SEND_VAL_EX                                              ~64
         94        SEND_VAR_EX                                              !3
         95        FETCH_CONSTANT                                   ~65     'DATA_CACHE_TIMEOUT'
         96        SEND_VAL_EX                                              ~65
         97        DO_FCALL                                      0          
   59    98    >   FETCH_DIM_R                                      ~67     !3, 'LR_ID'
         99        ASSIGN                                                   !6, ~67
   61   100        INIT_METHOD_CALL                                         !1, 'createCommand'
        101        ROPE_INIT                                     3  ~70     'INSERT+INTO+tblDistrict+%28District_ID%2C+State_ID%29+VALUES%28%27'
        102        ROPE_ADD                                      1  ~70     ~70, !6
        103        ROPE_END                                      2  ~69     ~70, '%27%2C+%27'
        104        FETCH_CONSTANT                                   ~72     'STATE_ID'
        105        CONCAT                                           ~73     ~69, ~72
        106        CONCAT                                           ~74     ~73, '%27%29+'
        107        SEND_VAL_EX                                              ~74
        108        DO_FCALL                                      0  $75     
        109        ASSIGN                                                   !2, $75
   62   110        INIT_METHOD_CALL                                         !2, 'execute'
        111        DO_FCALL                                      0  $77     
        112        ASSIGN                                                   !4, $77
   63   113        IS_EQUAL                                                 !4, 0
        114      > JMPZ                                                     ~79, ->122
   64   115    >   ROPE_INIT                                     3  ~81     'FATAL+ERROR+0x02%3A+Failed+to+insert+'
        116        ROPE_ADD                                      1  ~81     ~81, !0
        117        ROPE_END                                      2  ~80     ~81, '+in+Reference+table+%3A%3A+'
        118        CONCAT                                           ~83     ~80, '%2Fin%2F9q9JV'
        119        CONCAT                                           ~84     ~83, '+at+line+nunber+'
        120        CONCAT                                           ~85     ~84, '64'
        121      > EXIT                                                     ~85
   66   122    > > RETURN                                                   !6
        123*       JMP                                                      ->126
   71   124    >   FETCH_DIM_R                                      ~86     !3, 'LR_ID'
        125      > RETURN                                                   ~86
   73   126*     > RETURN                                                   null

End of function getdistid

End of class ImportController.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.55 ms | 1421 KiB | 25 Q