3v4l.org

run code in 300+ PHP versions simultaneously
<ul> <?php //function to retrieve posts from facebook’s server function loadFB($fbID){ $url = "http://graph.facebook.com/".$fbID."/feed?limit=3"; // Update by MC Vooges 11jun 2014: Access token is now required: $url.= '&access_token=YOUR_TOKEN|YOUR_ACCESS_SECRET';// * //load and setup CURL $c = curl_init($url); curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); //get data from facebook and decode JSON $page = json_decode(curl_exec($c)); //close the connection curl_close($c); //return the data as an object return $page->data; } /* Change These Values */ // Your Facebook ID $fbid = "190506416472588"; // How many posts to show? $fbLimit = 10; // Your Timezone date_default_timezone_set("America/Chicago"); /* Dont Change */ // Variable used to count how many we’ve loaded $fbCount = 0; // Call the function and get the posts from facebook $myPosts = loadFB($fbid); //loop through all the posts we got from facebook foreach($myPosts as $dPost){ //only show posts that are posted by the page admin if($dPost->from->id==$fbid){ //get the post date / time and convert to unix time $dTime = strtotime($dPost->created_time); //format the date / time into something human readable //if you want it formatted differently look up the php date function $myTime=date("M d Y h:ia",$dTime); ?> <ul> <li><?php echo($dPost->message) . $myTime; ?></li> </ul> <?php //increment counter $fbCount++; //if we’ve outputted the number set above in fblimit we’re done if($fbCount >= $fbLimit) break; } } ?> </ul>
Output for 7.0.0 - 7.0.7, 7.0.9 - 7.0.20, 7.1.0 - 7.1.7, 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0 - 8.5.1
<ul> Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/oLnpf:10 Stack trace: #0 /in/oLnpf(33): loadFB('190506416472588') #1 {main} thrown in /in/oLnpf on line 10
Process exited with code 255.
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.
Output for 7.1.10
<ul> Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/oLnpf:10 Stack trace: #0 /in/oLnpf(33): loadFB('190506416472588') #1 {main} thrown in /in/oLnpf on line 10
Process exited with code 137.
Output for 7.0.8

Process exited with code 137.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28
<ul> Fatal error: Call to undefined function curl_init() in /in/oLnpf on line 10
Process exited with code 255.
Output for 5.0.0 - 5.0.5
<ul> Fatal error: Call to undefined function date_default_timezone_set() in /in/oLnpf on line 26
Process exited with code 255.
Output for 4.4.5 - 4.4.9
<ul> Fatal error: Call to undefined function: date_default_timezone_set() in /in/oLnpf on line 26
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
<ul> Fatal error: Call to undefined function: date_default_timezone_set() in /in/oLnpf on line 26
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<ul> Fatal error: Call to undefined function: date_default_timezone_set() in /in/oLnpf on line 26

preferences:
64.33 ms | 418 KiB | 6 Q