3v4l.org

run code in 300+ PHP versions simultaneously
<?php function translate($from_lan, $to_lan, $text){ $json = json_decode(file_get_contents('https://ajax.googleapis.com/ajax/services/language/translate?v=1.0&q=' . urlencode($text) . '&langpair=' . $from_lan . '|' . $to_lan)); $translated_text = $json->responseData->translatedText; return $translated_text; } echo translate('en' , 'ar' , "Hello"); ?><?php
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q74QU
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'translate'
          1        SEND_VAL                                                 'en'
          2        SEND_VAL                                                 'ar'
          3        SEND_VAL                                                 'Hello'
          4        DO_FCALL                                      0  $0      
          5        ECHO                                                     $0
    9     6      > RETURN                                                   1

Function translate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q74QU
function name:  translate
number of ops:  23
compiled vars:  !0 = $from_lan, !1 = $to_lan, !2 = $text, !3 = $json, !4 = $translated_text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    3     3        INIT_FCALL                                               'json_decode'
          4        INIT_FCALL                                               'file_get_contents'
          5        INIT_FCALL                                               'urlencode'
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $5      
          8        CONCAT                                           ~6      'https%3A%2F%2Fajax.googleapis.com%2Fajax%2Fservices%2Flanguage%2Ftranslate%3Fv%3D1.0%26q%3D', $5
          9        CONCAT                                           ~7      ~6, '%26langpair%3D'
         10        CONCAT                                           ~8      ~7, !0
         11        CONCAT                                           ~9      ~8, '%7C'
         12        CONCAT                                           ~10     ~9, !1
         13        SEND_VAL                                                 ~10
         14        DO_ICALL                                         $11     
         15        SEND_VAR                                                 $11
         16        DO_ICALL                                         $12     
         17        ASSIGN                                                   !3, $12
    4    18        FETCH_OBJ_R                                      ~14     !3, 'responseData'
         19        FETCH_OBJ_R                                      ~15     ~14, 'translatedText'
         20        ASSIGN                                                   !4, ~15
    6    21      > RETURN                                                   !4
    7    22*     > RETURN                                                   null

End of function translate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.83 ms | 1399 KiB | 20 Q