3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('Europe/Athens'); // Create connection $conn = new mysqli("mysql.freehostia.com", "dimpou5_forum", "stella_0", "dimpou5_forum", 3306); $conn->set_charset("utf8"); $tablePrefix = ""; // Check connection if ($conn->connect_error) die("Connection failed: " . $conn->connect_error); /* $rows = array(); $sql = "SELECT * FROM structure"; $result = $conn->query($sql); if ($result->num_rows > 0) { // output data of each row while($row = $result->fetch_assoc()) { //echo "id: " . $row["id"]. " - Name: " . $row["name"]. "<br>"; $rows[] = $row; } } else { echo "0 results"; } $count_last_category = 0; $tree = buildTree($rows); $list_dom = print_ols($tree); echo $count_last_category; echo $list_dom; echo "\n"; echo date("d-m-Y") . "\n"; echo strtotime(date("d-m-Y")) . "\n"; print_r( skroutz_getPriceFromLink("http://www.skroutz.gr/s/6535417/Manta-MS1701.html")); */ $sql = "SELECT * FROM ".$tablePrefix."structure WHERE path LIKE '%kinhta%' LIMIT 1"; $result = $conn->query($sql); if ($result->num_rows > 0) { $row = $result->fetch_assoc(); $subcategory_url = $row['scheme'] . "://" . $row['host'] . $row['path']; skroutz_updateSubcategoriesProducts($subcategory_url, $conn, 1); echo "<span style='font-size: 15; font-weight: bold; color: green'>DONE! :)</span>"; } else { echo "0 results"; } /** apo edw 3ekiname */ function skroutz_updateSubcategoriesProducts($url, $connection, $sleep){ $numOfPages = skroutz_getNumOfPages($url); for ($i=1; $i <= $numOfPages; $i++) { $page_products = skroutz_getPageProducts($url . "?page=" . $i); skroutz_products_insert_update($page_products, $connection); sleep($sleep); } } //voithitiki //edw metrame poses selides exei.. //pernoume ola ta li pou einai mesa se class 'paginator' (einai apo dio fores, alla den mas niazei) //giati to proteleutaio theloume function skroutz_getNumOfPages($url){ $output = file_get_contents($url); $dom_output = new DomDocument(); @$dom_output->loadHTML(mb_convert_encoding($output, 'HTML-ENTITIES', 'UTF-8')); $finder = new DomXPath($dom_output); $nodes = $finder->query("//*[contains(@class, 'paginator')]//li"); return $nodes->item($nodes->length-2)->nodeValue; } function skroutz_getPageProducts($url){ $output = file_get_contents($url); $dom_output = new DomDocument(); @$dom_output->loadHTML(mb_convert_encoding($output, 'HTML-ENTITIES', 'UTF-8')); $finder = new DomXPath($dom_output); $products = array(); $nodes = $finder->query("//*[contains(@id, 'sku_list')]//li[contains(@class, 'line')]"); foreach($nodes as $i => $node){ $name = $finder->query("div[contains(@class, 'details')]/h2/a", $node)->item(0); $link = parse_url($name->getAttribute('href')); if(!isset($link['host'])){ $link['scheme'] = "http"; $link['host'] = "www.skroutz.gr"; } $price = trim($finder->query("p[contains(@class, 'price')]//a", $node)->item(0)->nodeValue); $price = str_replace(array(","," €"), "", $price); $products[$i]['id'] = skroutz_getProductIdFromUrl($name->getAttribute('href')); $products[$i]['category_id'] = skroutz_getCategoryIdFromUrl($url); $products[$i]['name'] = trim($name->nodeValue); $products[$i]['price']['date'] = date("Ymd"); $products[$i]['price']['value'] = $price; $products[$i]['scheme'] = $link['scheme']; $products[$i]['host'] = $link['host']; $products[$i]['path'] = $link['path']; } return $products; } /* skroutz_products_insert_update: pernei enan pinaka tis parakatw morfis kai ton vazei mesa ston pinaka 'products' KAI 'prices' * Array * ( * [0] => Array * ( * [id] => 6535417 * [category_id] => 40 * [name] => Manta MS1701 * [price] => Array * ( * [date] => 20151118 * [value] => 1580 * ) * * [scheme] => http * [host] => www.skroutz.gr * [path] => /s/6535417/Manta-MS1701.html * ) * [1] => Array * ( * .... * ) **/ function skroutz_products_insert_update($array, $connection){ global $tablePrefix; foreach ($array as $key => $value) { $sql = "INSERT INTO ".$tablePrefix."products (id, category_id, name, scheme, host, path) VALUES ('$value[id]', '$value[category_id]', '" . mysqli_real_escape_string($connection ,$value['name']) . "', '$value[scheme]', '$value[host]', '$value[path]') ON DUPLICATE KEY UPDATE category_id='$value[category_id]', name='" . mysqli_real_escape_string($connection, $value['name']) . "'"; if ($connection->query($sql) === TRUE) { echo "$value[name] .................successfully<br>\n"; } else { echo "Error: " . $sql . "<br>" . $connection->error; } $sql = "INSERT INTO ".$tablePrefix."prices (id, date, price, lastUpdate) VALUES ('$value[id]', '".$value["price"]["date"]."', '".$value["price"]["value"]."', NOW()) ON DUPLICATE KEY UPDATE price='".$value["price"]["value"]."', lastUpdate=NOW()"; if ($connection->query($sql) === TRUE) { echo "$value[name] .................successfully<br>\n"; } else { echo "Error: " . $sql . "<br>" . $connection->error; } } } /* function skroutz_getPageProducts($url){ $output = file_get_contents($url); $dom_output = new DomDocument(); @$dom_output->loadHTML(mb_convert_encoding($output, 'HTML-ENTITIES', 'UTF-8')); $finder = new DomXPath($dom_output); $products = array(); $nodes = $finder->query("//*[contains(@id, 'sku_list')]//li[contains(@class, 'line')]//h2//a"); foreach($nodes as $i => $node){ $link = parse_url($node->getAttribute('href')); if(!isset($link['host'])){ $link['scheme'] = "http"; $link['host'] = "www.skroutz.gr"; } $products[$i]['id'] = skroutz_getProductIdFromUrl($node->getAttribute('href')); $products[$i]['category_id'] = skroutz_getCategoryIdFromUrl($url); $products[$i]['name'] = trim($node->nodeValue); $products[$i]['scheme'] = $link['scheme']; $products[$i]['host'] = $link['host']; $products[$i]['path'] = $link['path']; } return $products; } */ $conn->close(); //den xrisimopoieite pros to paron function skroutz_getPriceFromLink($link){ $link_json = substr($link, 0, -5) . "/price_graph.json"; $output = json_decode(file_get_contents($link_json)); $index = count($output->min_price->recent) - 1; $current_price = $output->min_price->recent[$index]; return $current_price; } function print_ols($array){ global $count_last_category; $return = "<ol>"; foreach ($array as $key => $value) { $return .= "<li value='$value[id]'>"; $return .= $value['name']; if(isset($value['children'])) $return .= print_ols($value['children']); else $count_last_category++; $return .= "</li>"; } $return .= "</ol>"; return $return; } //http://stackoverflow.com/questions/8587341/recursive-function-to-generate-multidimensional-array-from-database-result function buildTree(array $elements, $parentId = 0) { $branch = array(); foreach ($elements as $element) { if ($element['parent_id'] == $parentId) { $children = buildTree($elements, $element['id']); if ($children) { $element['children'] = $children; } $branch[] = $element; } } return $branch; } //voithitiki function skroutz_getCategoryIdFromUrl($url){ $parts = explode('/', $url); foreach ($parts as $key => $value) { if ($value == "c"){ return $parts[$key + 1]; } } return 0; //an ftasei mexri edw, den exei parent } //voithitiki function skroutz_getProductIdFromUrl($url){ $parts = explode('/', $url); foreach ($parts as $key => $value) { if ($value == "s"){ return $parts[$key + 1]; } } return 0; //an ftasei mexri edw, den exei parent } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 47
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DJqad
function name:  (null)
number of ops:  51
compiled vars:  !0 = $conn, !1 = $tablePrefix, !2 = $sql, !3 = $result, !4 = $row, !5 = $subcategory_url
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'date_default_timezone_set'
          1        SEND_VAL                                                 'Europe%2FAthens'
          2        DO_ICALL                                                 
    5     3        NEW                                              $7      'mysqli'
          4        SEND_VAL_EX                                              'mysql.freehostia.com'
          5        SEND_VAL_EX                                              'dimpou5_forum'
          6        SEND_VAL_EX                                              'stella_0'
          7        SEND_VAL_EX                                              'dimpou5_forum'
          8        SEND_VAL_EX                                              3306
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !0, $7
    6    11        INIT_METHOD_CALL                                         !0, 'set_charset'
         12        SEND_VAL_EX                                              'utf8'
         13        DO_FCALL                                      0          
    7    14        ASSIGN                                                   !1, ''
    9    15        FETCH_OBJ_R                                      ~12     !0, 'connect_error'
         16      > JMPZ                                                     ~12, ->20
         17    >   FETCH_OBJ_R                                      ~13     !0, 'connect_error'
         18        CONCAT                                           ~14     'Connection+failed%3A+', ~13
         19      > EXIT                                                     ~14
   50    20    >   CONCAT                                           ~15     'SELECT+%2A+FROM++', !1
         21        CONCAT                                           ~16     ~15, 'structure+WHERE+path+LIKE++%27%25kinhta%25%27+LIMIT+1'
         22        ASSIGN                                                   !2, ~16
   51    23        INIT_METHOD_CALL                                         !0, 'query'
         24        SEND_VAR_EX                                              !2
         25        DO_FCALL                                      0  $18     
         26        ASSIGN                                                   !3, $18
   53    27        FETCH_OBJ_R                                      ~20     !3, 'num_rows'
         28        IS_SMALLER                                               0, ~20
         29      > JMPZ                                                     ~21, ->47
   54    30    >   INIT_METHOD_CALL                                         !3, 'fetch_assoc'
         31        DO_FCALL                                      0  $22     
         32        ASSIGN                                                   !4, $22
   55    33        FETCH_DIM_R                                      ~24     !4, 'scheme'
         34        CONCAT                                           ~25     ~24, '%3A%2F%2F'
         35        FETCH_DIM_R                                      ~26     !4, 'host'
         36        CONCAT                                           ~27     ~25, ~26
         37        FETCH_DIM_R                                      ~28     !4, 'path'
         38        CONCAT                                           ~29     ~27, ~28
         39        ASSIGN                                                   !5, ~29
   57    40        INIT_FCALL_BY_NAME                                       'skroutz_updateSubcategoriesProducts'
         41        SEND_VAR_EX                                              !5
         42        SEND_VAR_EX                                              !0
         43        SEND_VAL_EX                                              1
         44        DO_FCALL                                      0          
   58    45        ECHO                                                     '%3Cspan+style%3D%27font-size%3A+15%3B+font-weight%3A+bold%3B+color%3A+green%27%3EDONE%21+%3A%29%3C%2Fspan%3E'
         46      > JMP                                                      ->48
   60    47    >   ECHO                                                     '0+results'
  210    48    >   INIT_METHOD_CALL                                         !0, 'close'
         49        DO_FCALL                                      0          
  276    50      > RETURN                                                   1

Function skroutz_updatesubcategoriesproducts:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 9
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 9
Branch analysis from position: 25
Branch analysis from position: 9
filename:       /in/DJqad
function name:  skroutz_updateSubcategoriesProducts
number of ops:  26
compiled vars:  !0 = $url, !1 = $connection, !2 = $sleep, !3 = $numOfPages, !4 = $i, !5 = $page_products
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   68     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   69     3        INIT_FCALL_BY_NAME                                       'skroutz_getNumOfPages'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $6      
          6        ASSIGN                                                   !3, $6
   71     7        ASSIGN                                                   !4, 1
          8      > JMP                                                      ->23
   72     9    >   INIT_FCALL_BY_NAME                                       'skroutz_getPageProducts'
         10        CONCAT                                           ~9      !0, '%3Fpage%3D'
         11        CONCAT                                           ~10     ~9, !4
         12        SEND_VAL_EX                                              ~10
         13        DO_FCALL                                      0  $11     
         14        ASSIGN                                                   !5, $11
   73    15        INIT_FCALL_BY_NAME                                       'skroutz_products_insert_update'
         16        SEND_VAR_EX                                              !5
         17        SEND_VAR_EX                                              !1
         18        DO_FCALL                                      0          
   74    19        INIT_FCALL                                               'sleep'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                                 
   71    22        PRE_INC                                                  !4
         23    >   IS_SMALLER_OR_EQUAL                                      !4, !3
         24      > JMPNZ                                                    ~16, ->9
   76    25    > > RETURN                                                   null

End of function skroutz_updatesubcategoriesproducts

Function skroutz_getnumofpages:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DJqad
function name:  skroutz_getNumOfPages
number of ops:  34
compiled vars:  !0 = $url, !1 = $output, !2 = $dom_output, !3 = $finder, !4 = $nodes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   82     0  E >   RECV                                             !0      
   83     1        INIT_FCALL                                               'file_get_contents'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
   85     5        NEW                                              $7      'DomDocument'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !2, $7
   86     8        BEGIN_SILENCE                                    ~10     
          9        INIT_METHOD_CALL                                         !2, 'loadHTML'
         10        INIT_FCALL                                               'mb_convert_encoding'
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 'HTML-ENTITIES'
         13        SEND_VAL                                                 'UTF-8'
         14        DO_ICALL                                         $11     
         15        SEND_VAR_NO_REF_EX                                       $11
         16        DO_FCALL                                      0          
         17        END_SILENCE                                              ~10
   87    18        NEW                                              $13     'DomXPath'
         19        SEND_VAR_EX                                              !2
         20        DO_FCALL                                      0          
         21        ASSIGN                                                   !3, $13
   89    22        INIT_METHOD_CALL                                         !3, 'query'
         23        SEND_VAL_EX                                              '%2F%2F%2A%5Bcontains%28%40class%2C+%27paginator%27%29%5D%2F%2Fli'
         24        DO_FCALL                                      0  $16     
         25        ASSIGN                                                   !4, $16
   91    26        INIT_METHOD_CALL                                         !4, 'item'
         27        FETCH_OBJ_R                                      ~18     !4, 'length'
         28        SUB                                              ~19     ~18, 2
         29        SEND_VAL_EX                                              ~19
         30        DO_FCALL                                      0  $20     
         31        FETCH_OBJ_R                                      ~21     $20, 'nodeValue'
         32      > RETURN                                                   ~21
   92    33*     > RETURN                                                   null

End of function skroutz_getnumofpages

Function skroutz_getpageproducts:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 28, Position 2 = 116
Branch analysis from position: 28
2 jumps found. (Code = 78) Position 1 = 29, Position 2 = 116
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 48, Position 2 = 52
Branch analysis from position: 48
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 52
Branch analysis from position: 116
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 116
filename:       /in/DJqad
function name:  skroutz_getPageProducts
number of ops:  119
compiled vars:  !0 = $url, !1 = $output, !2 = $dom_output, !3 = $finder, !4 = $products, !5 = $nodes, !6 = $node, !7 = $i, !8 = $name, !9 = $link, !10 = $price
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   94     0  E >   RECV                                             !0      
   95     1        INIT_FCALL                                               'file_get_contents'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $11     
          4        ASSIGN                                                   !1, $11
   97     5        NEW                                              $13     'DomDocument'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !2, $13
   98     8        BEGIN_SILENCE                                    ~16     
          9        INIT_METHOD_CALL                                         !2, 'loadHTML'
         10        INIT_FCALL                                               'mb_convert_encoding'
         11        SEND_VAR                                                 !1
         12        SEND_VAL                                                 'HTML-ENTITIES'
         13        SEND_VAL                                                 'UTF-8'
         14        DO_ICALL                                         $17     
         15        SEND_VAR_NO_REF_EX                                       $17
         16        DO_FCALL                                      0          
         17        END_SILENCE                                              ~16
   99    18        NEW                                              $19     'DomXPath'
         19        SEND_VAR_EX                                              !2
         20        DO_FCALL                                      0          
         21        ASSIGN                                                   !3, $19
  101    22        ASSIGN                                                   !4, <array>
  103    23        INIT_METHOD_CALL                                         !3, 'query'
         24        SEND_VAL_EX                                              '%2F%2F%2A%5Bcontains%28%40id%2C+%27sku_list%27%29%5D%2F%2Fli%5Bcontains%28%40class%2C+%27line%27%29%5D'
         25        DO_FCALL                                      0  $23     
         26        ASSIGN                                                   !5, $23
  104    27      > FE_RESET_R                                       $25     !5, ->116
         28    > > FE_FETCH_R                                       ~26     $25, !6, ->116
         29    >   ASSIGN                                                   !7, ~26
  105    30        INIT_METHOD_CALL                                         !3, 'query'
         31        SEND_VAL_EX                                              'div%5Bcontains%28%40class%2C+%27details%27%29%5D%2Fh2%2Fa'
         32        SEND_VAR_EX                                              !6
         33        DO_FCALL                                      0  $28     
         34        INIT_METHOD_CALL                                         $28, 'item'
         35        SEND_VAL_EX                                              0
         36        DO_FCALL                                      0  $29     
         37        ASSIGN                                                   !8, $29
  107    38        INIT_FCALL                                               'parse_url'
         39        INIT_METHOD_CALL                                         !8, 'getAttribute'
         40        SEND_VAL_EX                                              'href'
         41        DO_FCALL                                      0  $31     
         42        SEND_VAR                                                 $31
         43        DO_ICALL                                         $32     
         44        ASSIGN                                                   !9, $32
  108    45        ISSET_ISEMPTY_DIM_OBJ                         0  ~34     !9, 'host'
         46        BOOL_NOT                                         ~35     ~34
         47      > JMPZ                                                     ~35, ->52
  109    48    >   ASSIGN_DIM                                               !9, 'scheme'
         49        OP_DATA                                                  'http'
  110    50        ASSIGN_DIM                                               !9, 'host'
         51        OP_DATA                                                  'www.skroutz.gr'
  113    52    >   INIT_FCALL                                               'trim'
         53        INIT_METHOD_CALL                                         !3, 'query'
         54        SEND_VAL_EX                                              'p%5Bcontains%28%40class%2C+%27price%27%29%5D%2F%2Fa'
         55        SEND_VAR_EX                                              !6
         56        DO_FCALL                                      0  $38     
         57        INIT_METHOD_CALL                                         $38, 'item'
         58        SEND_VAL_EX                                              0
         59        DO_FCALL                                      0  $39     
         60        FETCH_OBJ_R                                      ~40     $39, 'nodeValue'
         61        SEND_VAL                                                 ~40
         62        DO_ICALL                                         $41     
         63        ASSIGN                                                   !10, $41
  114    64        INIT_FCALL                                               'str_replace'
         65        SEND_VAL                                                 <array>
         66        SEND_VAL                                                 ''
         67        SEND_VAR                                                 !10
         68        DO_ICALL                                         $43     
         69        ASSIGN                                                   !10, $43
  116    70        INIT_FCALL_BY_NAME                                       'skroutz_getProductIdFromUrl'
         71        INIT_METHOD_CALL                                         !8, 'getAttribute'
         72        SEND_VAL_EX                                              'href'
         73        DO_FCALL                                      0  $47     
         74        SEND_VAR_NO_REF_EX                                       $47
         75        DO_FCALL                                      0  $48     
         76        FETCH_DIM_W                                      $45     !4, !7
         77        ASSIGN_DIM                                               $45, 'id'
         78        OP_DATA                                                  $48
  117    79        INIT_FCALL_BY_NAME                                       'skroutz_getCategoryIdFromUrl'
         80        SEND_VAR_EX                                              !0
         81        DO_FCALL                                      0  $51     
         82        FETCH_DIM_W                                      $49     !4, !7
         83        ASSIGN_DIM                                               $49, 'category_id'
         84        OP_DATA                                                  $51
  118    85        INIT_FCALL                                               'trim'
         86        FETCH_OBJ_R                                      ~54     !8, 'nodeValue'
         87        SEND_VAL                                                 ~54
         88        DO_ICALL                                         $55     
         89        FETCH_DIM_W                                      $52     !4, !7
         90        ASSIGN_DIM                                               $52, 'name'
         91        OP_DATA                                                  $55
  119    92        INIT_FCALL                                               'date'
         93        SEND_VAL                                                 'Ymd'
         94        DO_ICALL                                         $59     
         95        FETCH_DIM_W                                      $56     !4, !7
         96        FETCH_DIM_W                                      $57     $56, 'price'
         97        ASSIGN_DIM                                               $57, 'date'
         98        OP_DATA                                                  $59
  120    99        FETCH_DIM_W                                      $60     !4, !7
        100        FETCH_DIM_W                                      $61     $60, 'price'
        101        ASSIGN_DIM                                               $61, 'value'
        102        OP_DATA                                                  !10
  121   103        FETCH_DIM_R                                      ~65     !9, 'scheme'
        104        FETCH_DIM_W                                      $63     !4, !7
        105        ASSIGN_DIM                                               $63, 'scheme'
        106        OP_DATA                                                  ~65
  122   107        FETCH_DIM_R                                      ~68     !9, 'host'
        108        FETCH_DIM_W                                      $66     !4, !7
        109        ASSIGN_DIM                                               $66, 'host'
        110        OP_DATA                                                  ~68
  123   111        FETCH_DIM_R                                      ~71     !9, 'path'
        112        FETCH_DIM_W                                      $69     !4, !7
        113        ASSIGN_DIM                                               $69, 'path'
        114        OP_DATA                                                  ~71
  104   115      > JMP                                                      ->28
        116    >   FE_FREE                                                  $25
  126   117      > RETURN                                                   !4
  127   118*     > RETURN                                                   null

End of function skroutz_getpageproducts

Function skroutz_products_insert_update:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 95
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 95
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 55
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 60
Branch analysis from position: 60
2 jumps found. (Code = 43) Position 1 = 84, Position 2 = 89
Branch analysis from position: 84
1 jumps found. (Code = 42) Position 1 = 94
Branch analysis from position: 94
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 89
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 55
2 jumps found. (Code = 43) Position 1 = 84, Position 2 = 89
Branch analysis from position: 84
Branch analysis from position: 89
Branch analysis from position: 95
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 95
filename:       /in/DJqad
function name:  skroutz_products_insert_update
number of ops:  97
compiled vars:  !0 = $array, !1 = $connection, !2 = $tablePrefix, !3 = $value, !4 = $key, !5 = $sql
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  153     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  154     2        BIND_GLOBAL                                              !2, 'tablePrefix'
  156     3      > FE_RESET_R                                       $6      !0, ->95
          4    > > FE_FETCH_R                                       ~7      $6, !3, ->95
          5    >   ASSIGN                                                   !4, ~7
  157     6        CONCAT                                           ~9      'INSERT%09INTO+', !2
          7        ROPE_INIT                                     5  ~13     'products+%28id%2C+category_id%2C+name%2C+scheme%2C+host%2C+path%29%0A%09%09%09%09%09%09VALUES+%28%27'
  158     8        FETCH_DIM_R                                      ~10     !3, 'id'
          9        ROPE_ADD                                      1  ~13     ~13, ~10
         10        ROPE_ADD                                      2  ~13     ~13, '%27%2C+%27'
         11        FETCH_DIM_R                                      ~11     !3, 'category_id'
         12        ROPE_ADD                                      3  ~13     ~13, ~11
         13        ROPE_END                                      4  ~12     ~13, '%27%2C+%27'
         14        CONCAT                                           ~16     ~9, ~12
         15        INIT_FCALL_BY_NAME                                       'mysqli_real_escape_string'
         16        SEND_VAR_EX                                              !1
         17        CHECK_FUNC_ARG                                           
         18        FETCH_DIM_FUNC_ARG                               $17     !3, 'name'
         19        SEND_FUNC_ARG                                            $17
         20        DO_FCALL                                      0  $18     
         21        CONCAT                                           ~19     ~16, $18
         22        ROPE_INIT                                     9  ~25     '%27%2C+%27'
         23        FETCH_DIM_R                                      ~20     !3, 'scheme'
         24        ROPE_ADD                                      1  ~25     ~25, ~20
         25        ROPE_ADD                                      2  ~25     ~25, '%27%2C+%27'
         26        FETCH_DIM_R                                      ~21     !3, 'host'
         27        ROPE_ADD                                      3  ~25     ~25, ~21
         28        ROPE_ADD                                      4  ~25     ~25, '%27%2C+%27'
         29        FETCH_DIM_R                                      ~22     !3, 'path'
         30        ROPE_ADD                                      5  ~25     ~25, ~22
         31        ROPE_ADD                                      6  ~25     ~25, '%27%29%0A%09%09%09%09%09%09ON+DUPLICATE+KEY+UPDATE+category_id%3D%27'
  159    32        FETCH_DIM_R                                      ~23     !3, 'category_id'
         33        ROPE_ADD                                      7  ~25     ~25, ~23
         34        ROPE_END                                      8  ~24     ~25, '%27%2C+name%3D%27'
         35        CONCAT                                           ~30     ~19, ~24
         36        INIT_FCALL_BY_NAME                                       'mysqli_real_escape_string'
         37        SEND_VAR_EX                                              !1
         38        CHECK_FUNC_ARG                                           
         39        FETCH_DIM_FUNC_ARG                               $31     !3, 'name'
         40        SEND_FUNC_ARG                                            $31
         41        DO_FCALL                                      0  $32     
         42        CONCAT                                           ~33     ~30, $32
         43        CONCAT                                           ~34     ~33, '%27'
  157    44        ASSIGN                                                   !5, ~34
  160    45        INIT_METHOD_CALL                                         !1, 'query'
         46        SEND_VAR_EX                                              !5
         47        DO_FCALL                                      0  $36     
         48        TYPE_CHECK                                    8          $36
         49      > JMPZ                                                     ~37, ->55
  161    50    >   FETCH_DIM_R                                      ~38     !3, 'name'
         51        NOP                                                      
         52        FAST_CONCAT                                      ~39     ~38, '+.................successfully%3Cbr%3E%0A'
         53        ECHO                                                     ~39
         54      > JMP                                                      ->60
  163    55    >   CONCAT                                           ~40     'Error%3A+', !5
         56        CONCAT                                           ~41     ~40, '%3Cbr%3E'
         57        FETCH_OBJ_R                                      ~42     !1, 'error'
         58        CONCAT                                           ~43     ~41, ~42
         59        ECHO                                                     ~43
  166    60    >   CONCAT                                           ~44     'INSERT%09INTO+', !2
         61        ROPE_INIT                                     3  ~47     'prices+%28id%2C+date%2C+price%2C+lastUpdate%29%0A%09%09%09%09%09%09VALUES+%28%27'
  167    62        FETCH_DIM_R                                      ~45     !3, 'id'
         63        ROPE_ADD                                      1  ~47     ~47, ~45
         64        ROPE_END                                      2  ~46     ~47, '%27%2C+%27'
         65        CONCAT                                           ~49     ~44, ~46
         66        FETCH_DIM_R                                      ~50     !3, 'price'
         67        FETCH_DIM_R                                      ~51     ~50, 'date'
         68        CONCAT                                           ~52     ~49, ~51
         69        CONCAT                                           ~53     ~52, '%27%2C+%27'
         70        FETCH_DIM_R                                      ~54     !3, 'price'
         71        FETCH_DIM_R                                      ~55     ~54, 'value'
         72        CONCAT                                           ~56     ~53, ~55
         73        CONCAT                                           ~57     ~56, '%27%2C+NOW%28%29%29%0A%09%09%09%09%09%09ON+DUPLICATE+KEY+UPDATE+price%3D%27'
  168    74        FETCH_DIM_R                                      ~58     !3, 'price'
         75        FETCH_DIM_R                                      ~59     ~58, 'value'
         76        CONCAT                                           ~60     ~57, ~59
         77        CONCAT                                           ~61     ~60, '%27%2C+lastUpdate%3DNOW%28%29'
  166    78        ASSIGN                                                   !5, ~61
  169    79        INIT_METHOD_CALL                                         !1, 'query'
         80        SEND_VAR_EX                                              !5
         81        DO_FCALL                                      0  $63     
         82        TYPE_CHECK                                    8          $63
         83      > JMPZ                                                     ~64, ->89
  170    84    >   FETCH_DIM_R                                      ~65     !3, 'name'
         85        NOP                                                      
         86        FAST_CONCAT                                      ~66     ~65, '+.................successfully%3Cbr%3E%0A'
         87        ECHO                                                     ~66
         88      > JMP                                                      ->94
  172    89    >   CONCAT                                           ~67     'Error%3A+', !5
         90        CONCAT                                           ~68     ~67, '%3Cbr

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.96 ms | 1428 KiB | 29 Q