3v4l.org

run code in 300+ PHP versions simultaneously
<?php <?php function category_select_value($array, $parentid, $cat_array, $count) { $count++; foreach ($array[$parentid] as $cat) { if(isset($cat_array) && in_array($cat->name, $cat_array)) { echo "<option value=\"".$cat->name."\" checked=\"checked\" selected>"; } else { echo "<option value=\"".$cat->name."\">"; } for ($i=0;$i<$count;$i++) echo "&nbsp;&nbsp;"; echo $cat->name."</option>"; //echo $cat->name."<br>"; if (array_key_exists ($cat->term_id, $array)) category_select_value($array, $cat->term_id, $cat_array, $count); } } global $wpdb; $blog_cat = $cat_exclude; /* if(is_array($blog_cat) && $blog_cat[0]!=''){ $blog_cat = get_blog_sub_cats_str($type='string'); }else{ $blog_cat = ''; } if($blog_cat) { $blog_cat .= ",1"; }else { $blog_cat .= "1"; }*/ global $price_db_table_name; if($_REQUEST['pkg']){ $pkg_id = mysql_real_escape_string($_REQUEST['pkg']); $package_cats = $wpdb->get_var("select cat from $price_db_table_name where pid=$pkg_id"); } if($package_cats) { if($blog_cat){ $blog_cat .= ",".$package_cats; }else { $blog_cat .= $package_cats; } } if($blog_cat) { $substr = " and c.term_id not in ($blog_cat)"; } $catsql = "select c.term_id, c.name, tt.parent from $wpdb->terms c,$wpdb->term_taxonomy tt where tt.term_id=c.term_id and tt.taxonomy='placecategory' $substr order by c.name"; $catinfo = $wpdb->get_results($catsql); $parentsql = "select c.term_id, c.name, tt.parent from $wpdb->terms c,$wpdb->term_taxonomy tt where tt.term_id=c.term_id and tt.taxonomy='placecategory' $substr order by tt.parent, c.name"; $parentinfo = $wpdb->get_results($parentsql); $categories=array(); foreach ($parentinfo as $key=>$info) { $categories[$info->parent][$info->term_id]=$info; } global $cat_array; if($catinfo) { $cat_display=get_option('ptthemes_category_dislay'); if($cat_display==''){$cat_display='checkbox';} $counter = 0; if($cat_display=='select'){?> <div class="form_cat" > <select name="category[]" id="category_<?php echo $counter;?>" class="textfield" > <?php category_select_value ($categories, 0, $cat_array, 0); } foreach($catinfo as $catinfo_obj) { $counter++; $termid = $catinfo_obj->term_id; $name = $catinfo_obj->name; if($cat_display=='checkbox'){ ?> <?php }elseif($cat_display=='radio'){ ?> <?php }elseif($cat_display=='select') { continue;?> <option <?php if(isset($cat_array) && in_array($name,$cat_array)){ echo 'selected="selected"'; }?> value="<?php echo $name; ?>"> <?php echo "$name"; ?></option> <?php } } if($cat_display=='select'){?> </select></div> <?php } } ?><?php $cat_display=get_option('ptthemes_category_dislay'); if($cat_display=='checkbox') { $limit_code =''; if($cat_limit){?> <script type="text/javascript"> /*<![CDATA[*/ var checked = 0; function addCheck(box) { // allow checked box to be unchecked if(!box.checked) return true; // get ref to collection // see Alt: var boxes = document.getElementsByName(box.name); // count checked var cb, count=0, k=0; while(cb=boxes[k++]) if(cb.checked && ++count><?php echo $cat_limit; ?>){ alert("<?php printf( _n( 'Sorry, you can select only %d category with this package.', 'Sorry, you can select only %d categories with this package.', $cat_limit ), $cat_limit );?>"); return false; } return true; } /*]]>*/ </script> <?php $limit_code = 'onclick="return addCheck(this);"';} $args=array( 'orderby' => 'name', 'include' => $catstring, 'exclude' => $blog_cat, 'hide_empty'=> 0, 'parent'=>0, 'taxonomy'=> 'placecategory', ); $counter=0; $categories=get_categories($args); foreach ($categories as $category) { $counter++; ?> <div class="form_cat" style="width:400px;" ><label><input type="checkbox" name="category[]" <?php echo $limit_code; ?> id="category_<?php echo $counter;?>" value="<?php echo $category->name; ?>" class="checkbox" <?php if(isset($cat_array) && in_array($category->name,$cat_array)){echo 'checked="checked"'; }?> />&nbsp;<?php echo $category->name;?></label></div> <div class="togglecats" id="togglecatscategory_<?php echo $counter;?>"> <?php $args=array( 'orderby' => 'name', 'include' => $catstring, 'exclude' => $blog_cat, 'hide_empty'=> 0, 'taxonomy'=> 'placecategory', 'parent'=>$category->term_id, ); $subcategories=get_categories($args); foreach ($subcategories as $subcategory) { $counter++; ?> <div class="form_subcat" style="width:400px; padding-left:15px;" ><label><input type="checkbox" name="category[]" <?php echo $limit_code; ?> id="category_<?php echo $counter;?>" value="<?php echo $subcategory->name; ?>" class="checkbox" <?php if(isset($cat_array) && in_array($subcategory->name,$cat_array)){echo 'checked="checked"'; }?> />&nbsp;<?php echo $subcategory->name;?></label></div> <?php } ?></div> <?php } } ?> <?php //echo '###'.$cat_exclude.'###'.$blog_cat; $cat_display=get_option('ptthemes_category_dislay'); if($cat_display=='radio') { $args=array( 'orderby' => 'name', 'include' => $catstring, 'exclude' => $blog_cat, 'hide_empty'=> 0, 'taxonomy'=> 'placecategory', 'parent'=>0, ); $counter=0; $categories=get_categories($args); foreach ($categories as $category) { $counter++; ?> <div class="form_cat" style="width:400px;" ><label><input type="radio" name="category[]" id="category_<?php echo $counter;?>" value="<?php echo $category->name; ?>" class="checkbox" <?php if(isset($cat_array) && in_array($category->name,$cat_array)){echo 'checked="checked"'; }?> />&nbsp;<?php echo $category->name;?></label></div> <div class="togglecats" id="togglecats<?php echo $category->name; ?>"> <?php $args=array( 'orderby' => 'name', 'include' => $catstring, 'exclude' => $blog_cat, 'hide_empty'=> 0, 'parent'=>$category->term_id, ); $subcategories=get_categories($args); foreach ($subcategories as $subcategory) { $counter++; ?> <div class="form_subcat" style="width:400px; padding-left:15px;" ><label><input type="radio" name="category[]" id="category_<?php echo $counter;?>" value="<?php echo $subcategory->name; ?>" class="checkbox" <?php if(isset($cat_array) && in_array($subcategory->term_id,$cat_array)){echo 'checked="checked"'; }?> />&nbsp;<?php echo $subcategory->name;?></label></div> <?php } ?></div> <?php } } ?>

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)
5.4.250.0100.03712.39
5.4.240.0050.03612.36
5.4.230.0060.04112.36
5.4.220.0060.03812.36
5.4.210.0100.03112.36
5.4.200.0090.03612.36
5.4.190.0050.03612.35
5.4.180.0060.03812.36
5.4.170.0090.03312.36
5.4.160.0050.04212.35
5.4.150.0100.03812.35
5.4.140.0050.04112.04
5.4.130.0080.03412.02
5.4.120.0050.03711.98
5.4.110.0030.03911.98
5.4.100.0060.03611.98
5.4.90.0090.03411.98
5.4.80.0020.04011.98
5.4.70.0080.03411.98
5.4.60.0040.03811.98
5.4.50.0040.03811.97
5.4.40.0060.03611.96
5.4.30.0070.03511.96
5.4.20.0060.03911.96
5.4.10.0050.03811.96
5.4.00.0030.03811.45
5.3.280.0060.03812.71
5.3.270.0030.04112.72
5.3.260.0060.03912.72
5.3.250.0050.04012.72
5.3.240.0080.05112.72
5.3.230.0070.03912.71
5.3.220.0040.04012.68
5.3.210.0110.03712.68
5.3.200.0070.04512.68
5.3.190.0070.03712.68
5.3.180.0050.03912.68
5.3.170.0080.03512.67
5.3.160.0090.03712.67
5.3.150.0050.04312.68
5.3.140.0090.03612.66
5.3.130.0070.04112.66
5.3.120.0030.04312.66
5.3.110.0080.03712.65
5.3.100.0060.03812.12
5.3.90.0070.03712.08
5.3.80.0040.03812.08
5.3.70.0060.04712.07
5.3.60.0050.05112.06
5.3.50.0100.03912.00
5.3.40.0090.05812.00
5.3.30.0070.04811.94
5.3.20.0110.04211.70
5.3.10.0070.04811.66
5.3.00.0030.05111.64

preferences:
140.18 ms | 1394 KiB | 7 Q