3v4l.org

run code in 300+ PHP versions simultaneously
<?php $serverApiKey = "AIzaSyBFtNb7a_TCtxSqkiWUc5qGKVJ1KJtIa0s"; $reg_id = "fwrBnLTNyCg:APA91bGmHvhFWgXPJcXi7Lh5T1iBZ80u8KaXdhiNmoRTrk0nvCDDm-2dBd6esuCaG4hU33dU1oqU0jYQYvdRFm3alflhyXl7dhGyGb7PaFHbuU3FaSbsYfJagfe6NdLZDRElDU5cZoYc"; define("GOOGLE_API_KEY", "AIzaSyBFtNb7a_TCtxSqkiWUc5qGKVJ1KJtIa0s"); define("GOOGLE_GCM_URL", "https://android.googleapis.com/gcm/send"); function send_gcm_notify($reg_id, $message) { $fields = array( 'registration_ids' => array( $reg_id ), 'data' => array( "title" => "yolo", "message" => $message ), ); $headers = array( 'Authorization: key=' . GOOGLE_API_KEY, 'Content-Type: application/json' ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, GOOGLE_GCM_URL); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); $result = curl_exec($ch); if ($result === FALSE) { die('Problem occurred: ' . curl_error($ch)); } curl_close($ch); echo $result; } $msg = "Google Cloud Messaging working well"; send_gcm_notify($reg_id, $msg);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9IbsZ
function name:  (null)
number of ops:  16
compiled vars:  !0 = $serverApiKey, !1 = $reg_id, !2 = $msg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'AIzaSyBFtNb7a_TCtxSqkiWUc5qGKVJ1KJtIa0s'
    3     1        ASSIGN                                                   !1, 'fwrBnLTNyCg%3AAPA91bGmHvhFWgXPJcXi7Lh5T1iBZ80u8KaXdhiNmoRTrk0nvCDDm-2dBd6esuCaG4hU33dU1oqU0jYQYvdRFm3alflhyXl7dhGyGb7PaFHbuU3FaSbsYfJagfe6NdLZDRElDU5cZoYc'
    5     2        INIT_FCALL                                               'define'
          3        SEND_VAL                                                 'GOOGLE_API_KEY'
          4        SEND_VAL                                                 'AIzaSyBFtNb7a_TCtxSqkiWUc5qGKVJ1KJtIa0s'
          5        DO_ICALL                                                 
    6     6        INIT_FCALL                                               'define'
          7        SEND_VAL                                                 'GOOGLE_GCM_URL'
          8        SEND_VAL                                                 'https%3A%2F%2Fandroid.googleapis.com%2Fgcm%2Fsend'
          9        DO_ICALL                                                 
   37    10        ASSIGN                                                   !2, 'Google+Cloud+Messaging+working+well'
   39    11        INIT_FCALL                                               'send_gcm_notify'
         12        SEND_VAR                                                 !1
         13        SEND_VAR                                                 !2
         14        DO_FCALL                                      0          
         15      > RETURN                                                   1

Function send_gcm_notify:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 62, Position 2 = 67
Branch analysis from position: 62
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 67
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9IbsZ
function name:  send_gcm_notify
number of ops:  72
compiled vars:  !0 = $reg_id, !1 = $message, !2 = $fields, !3 = $headers, !4 = $ch, !5 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   11     2        INIT_ARRAY                                       ~6      !0
          3        INIT_ARRAY                                       ~7      ~6, 'registration_ids'
   12     4        INIT_ARRAY                                       ~8      'yolo', 'title'
          5        ADD_ARRAY_ELEMENT                                ~8      !1, 'message'
          6        ADD_ARRAY_ELEMENT                                ~7      ~8, 'data'
   10     7        ASSIGN                                                   !2, ~7
   16     8        FETCH_CONSTANT                                   ~10     'GOOGLE_API_KEY'
          9        CONCAT                                           ~11     'Authorization%3A+key%3D', ~10
         10        INIT_ARRAY                                       ~12     ~11
   17    11        ADD_ARRAY_ELEMENT                                ~12     'Content-Type%3A+application%2Fjson'
   15    12        ASSIGN                                                   !3, ~12
   20    13        INIT_FCALL_BY_NAME                                       'curl_init'
         14        DO_FCALL                                      0  $14     
         15        ASSIGN                                                   !4, $14
   21    16        INIT_FCALL_BY_NAME                                       'curl_setopt'
         17        SEND_VAR_EX                                              !4
         18        FETCH_CONSTANT                                   ~16     'CURLOPT_URL'
         19        SEND_VAL_EX                                              ~16
         20        FETCH_CONSTANT                                   ~17     'GOOGLE_GCM_URL'
         21        SEND_VAL_EX                                              ~17
         22        DO_FCALL                                      0          
   22    23        INIT_FCALL_BY_NAME                                       'curl_setopt'
         24        SEND_VAR_EX                                              !4
         25        FETCH_CONSTANT                                   ~19     'CURLOPT_POST'
         26        SEND_VAL_EX                                              ~19
         27        SEND_VAL_EX                                              <true>
         28        DO_FCALL                                      0          
   23    29        INIT_FCALL_BY_NAME                                       'curl_setopt'
         30        SEND_VAR_EX                                              !4
         31        FETCH_CONSTANT                                   ~21     'CURLOPT_HTTPHEADER'
         32        SEND_VAL_EX                                              ~21
         33        SEND_VAR_EX                                              !3
         34        DO_FCALL                                      0          
   24    35        INIT_FCALL_BY_NAME                                       'curl_setopt'
         36        SEND_VAR_EX                                              !4
         37        FETCH_CONSTANT                                   ~23     'CURLOPT_RETURNTRANSFER'
         38        SEND_VAL_EX                                              ~23
         39        SEND_VAL_EX                                              <true>
         40        DO_FCALL                                      0          
   25    41        INIT_FCALL_BY_NAME                                       'curl_setopt'
         42        SEND_VAR_EX                                              !4
         43        FETCH_CONSTANT                                   ~25     'CURLOPT_SSL_VERIFYPEER'
         44        SEND_VAL_EX                                              ~25
         45        SEND_VAL_EX                                              <false>
         46        DO_FCALL                                      0          
   26    47        INIT_FCALL_BY_NAME                                       'curl_setopt'
         48        SEND_VAR_EX                                              !4
         49        FETCH_CONSTANT                                   ~27     'CURLOPT_POSTFIELDS'
         50        SEND_VAL_EX                                              ~27
         51        INIT_FCALL                                               'json_encode'
         52        SEND_VAR                                                 !2
         53        DO_ICALL                                         $28     
         54        SEND_VAR_NO_REF_EX                                       $28
         55        DO_FCALL                                      0          
   28    56        INIT_FCALL_BY_NAME                                       'curl_exec'
         57        SEND_VAR_EX                                              !4
         58        DO_FCALL                                      0  $30     
         59        ASSIGN                                                   !5, $30
   29    60        TYPE_CHECK                                    4          !5
         61      > JMPZ                                                     ~32, ->67
   30    62    >   INIT_FCALL_BY_NAME                                       'curl_error'
         63        SEND_VAR_EX                                              !4
         64        DO_FCALL                                      0  $33     
         65        CONCAT                                           ~34     'Problem+occurred%3A+', $33
         66      > EXIT                                                     ~34
   33    67    >   INIT_FCALL_BY_NAME                                       'curl_close'
         68        SEND_VAR_EX                                              !4
         69        DO_FCALL                                      0          
   34    70        ECHO                                                     !5
   35    71      > RETURN                                                   null

End of function send_gcm_notify

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.79 ms | 1411 KiB | 18 Q