3v4l.org

run code in 300+ PHP versions simultaneously
<?php <?php /* Template Name: Timeline JS 3 JSON page Description: Outputs the list Timeline Entries as JSON */ header('Content-type: application/json'); $args2 = array("category_name" => "timeline", "posts_per_page" => -1, "orderby" => "title", "order" => "ASC"); $query = new WP_Query( $args2 ); $posts = $query->posts; $output = array(); $main_title = array(); $main_events = array(); $main_title_text = array("headline" => "Tibetannewspapers Timeline", "text" => "" ); $main_title = array("text" => $main_title_text ); foreach ($posts as post ){ $the_date_start = get_field("start_date", $post->ID); $the_date_start_alternative = date("Y,m,d",strtotime($post->post_date)); $the_date_end = get_field("end_date", $post->ID); if ($the_date_start == "") { $the_date_start = $the_date_start_alternative; } if ($the_date_end =="") { $the_date_end = $the_date_start; } $startdate=array(); $startdate = array("year" => substr($the_date_start, 0, 4) ,month" => substr($the_date_start, 4, 2), "day" => substr($the_date_start, 6, 2)); $enddate=array(); $enddate = array("year" => substr($the_date_end, 0, 4) ,month" => substr($the_date_end, 4, 2), "day" => substr($the_date_end, 6, 2)); $media=array(); if( has_post_thumbnail( $post->ID) ) { $caption = get_post( get_post_thumbnail_id() )->post_excerpt; $mediaurl = get_the_post_thumbnail_url( $post->ID, 'full' ) ; $media=array("url" => $mediaurl, "credit" => "", "caption" => $caption); } $text = array(); $text= array("headline" => $post->post_title, "text" =>$post->post_content); $main_events[] = array("media" => $media, "start_date" => $startdate , "end_date" => $enddate , "text" => $text); } $output = array("title" => $main_title, "events" => $main_events); wp_reset_query(); $outputjson = json_encode($output); echo $outputjson; ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.1.70.0110.00717.04
7.1.60.0180.01534.89
7.1.50.0280.01634.73
7.1.40.0310.00634.50
7.1.30.0250.01634.56
7.1.20.0280.00834.52
7.1.10.0070.01416.08
7.1.00.0110.00616.46
7.0.200.0110.00816.50
7.0.190.0150.00616.20
7.0.180.0000.01815.99
7.0.170.0130.00615.85
7.0.160.0090.01015.99
7.0.150.0090.01216.04
7.0.140.0060.01616.09
7.0.130.0090.01216.31
7.0.120.0100.00616.43
7.0.110.0030.01616.18
7.0.100.0070.01116.13
7.0.90.0100.01316.33
7.0.80.0150.00916.39
7.0.70.0170.00716.09
7.0.60.0100.01216.11
7.0.50.0060.01616.32
7.0.40.0070.01016.41
7.0.30.0130.00616.39
7.0.20.0150.00716.25
7.0.10.0070.01416.44
7.0.00.0120.00616.24

preferences:
142.92 ms | 1386 KiB | 7 Q