3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function doHttpRequest($url, $post_data = NULL, $method = 'GET',) { $ch = curl_init(); $options = array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_HEADER => FALSE, CURLOPT_CUSTOMREQUEST => $method ); if (isset($post_data)){ if($method == "POST") { $options[CURLOPT_POST] = TRUE; $options[CURLOPT_POSTFIELDS] = $post_data; } else { $options[CURLOPT_URL] = $url .'?'. http_build_query($post_data,'','&'); } } curl_setopt_array($ch, $options); $response = curl_exec($ch); curl_close($ch); return $response; } $post_data = array( 'apiKey' => 'bbd9f56b9ec239745931df1026baee74', 'campaign' => '4732' ); $data = doHttpRequest('http://theappreciationengine.com/api/top',$post_data); ?>
Output for 5.4.0 - 5.4.26
Parse error: syntax error, unexpected ')', expecting '&' or variable (T_VARIABLE) in /in/SHl7L on line 2
Process exited with code 255.
Output for 5.1.0 - 5.3.28
Parse error: syntax error, unexpected ')', expecting '&' or T_VARIABLE in /in/SHl7L on line 2
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected ')', expecting '&' or T_VARIABLE in /in/SHl7L on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected ')', expecting '&' or T_VARIABLE or T_CONST in /in/SHl7L on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected ')', expecting '&' or T_VARIABLE or T_CONST in /in/SHl7L on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'&'' or `T_VARIABLE' or `T_CONST' in /in/SHl7L on line 2
Process exited with code 255.