3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dropDownList($field_name,$array_name,$default_value,$style="",$disabled="") { session_register('$field_name'); if ($disabled == 1) $disabled = "disabled"; if ($disabled != "disabled") $disabled = ""; echo "<Select name='$field_name' ".$style." ".$disabled." >"; echo "<option value=''></option>"; for ($loop=0;$loop<count($array_name);$loop++) { echo "<option value='".$array_name[$loop]['Value']."'"; if($array_name[$loop]['Value']== $default_value) { echo " selected"; $teamMember = $array_name[$loop]['Name']; global $teamName; $teamName = $array_name[$loop]['Name']; } echo ">".$array_name[$loop]['Name']."</option>"; } echo "</select>"; } function dropNBDownList($field_name,$array_name,$default_value,$style="") { session_register('$field_name'); echo "<Select name='$field_name' ".$style." >"; for ($loop=0;$loop<count($array_name);$loop++) { echo "<option value='".$array_name[$loop]['Value']."'"; if($array_name[$loop]['Value']== $default_value) { echo " selected"; } echo ">".$array_name[$loop]['Name']."</option>"; } echo "</select>"; } function showDownList($Field_Value,$MatchArray) { $ReturnValue=""; for ($loop=0;$loop<count($MatchArray);$loop++) { if($MatchArray[$loop]['Value']==$Field_Value) { $ReturnValue=$MatchArray[$loop]['Name']; } } return $ReturnValue; } function safeDivide($tmp1,$tmp2) { if($tmp2 > 0) { $result=$tmp1/$tmp2; } else { $result=0; } return $result; } function mkcheckbox($checkvalue) { if($checkvalue == '1') { echo "checked"; } } function reimport_get_vars() { reimport_any_vars("HTTP_GET_VARS"); } function reimport_post_vars() { reimport_any_vars("HTTP_POST_VARS"); } function reimport_cookie_vars() { reimport_any_vars("HTTP_COOKIE_VARS"); } function reimport_any_vars($arrayname) { global $$arrayname; if(!is_array($$arrayname)) return; reset($$arrayname); while(list($key, $val) = each($$arrayname)) { $GLOBALS[$key] = $val; } } function do_redirect_url($url,$message="One moment please...",$delay=0) { if(SID) { if(ereg("[?]",$url)) { $url .= "&".SID; } else { $url .= "?".SID; } } if($message=="default") { $message="One moment please..."; } if($delay=="default") { $delay=0; } echo("<HTML><HEAD><META HTTP-EQUIV=\"refresh\" CONTENT=\"$delay;url=$url\"></HEAD><BODY BGCOLOR=#ffffff>$message</BODY></HTML>"); } function fieldColor($TmpStatus) { switch ($TmpStatus) { case 1: $ColorBar='#FFCCCC'; break; case 2: case 3: case 10: $ColorBar='#FFFFCC'; break; case 5: case 6: case 7: $ColorBar='#fffffe'; break; case 9: $ColorBar='#99CC99'; break; case 8: case 11: case 4: $ColorBar='#99CCFF'; break; case 12: $ColorBar='#FCE398'; break; case 13: $ColorBar='#999999'; break; } return $ColorBar; } function business_days($pickDay) { $businessDays=0; $InDays=0; list($month, $day, $year) = split('[/.-]', $pickDay); $startDay=strtotime($month."/01/".$year); $pickDay=strtotime($pickDay); $endDay=strtotime($month."/".date("t",$startDay)."/".$year); $Temp_Array=array(); $daysDiff = (date("z",$endDay) - date("z",$startDay))+1; $Week=(date("W",$pickDay)-date("W",$startDay)); while($daysDiff) { switch(date("w",$endDay)) { case 0: case 6: break; default: $businessDays++; if($endDay <= $pickDay) { $InDays++; } break; } $endDay -= (60*60*24); $daysDiff--; } $Temp_Array['Projected']=$businessDays; $Temp_Array['Days']=$InDays; $Temp_Array['Week']=$Week; // ******************* // count for holidays // ******************* if($month == 7) { $Temp_Array['Projected']=$Temp_Array['Projected']-1; if($day >5) $Temp_Array['Days']=$Temp_Array['Days']-1; } if($month ==9) { $Temp_Array['Projected']=$Temp_Array['Projected']-1; if($day >6) $Temp_Array['Days']=$Temp_Array['Days']-1; } if($month ==12) { $Temp_Array['Projected']=$Temp_Array['Projected']-1; if($day >23) $Temp_Array['Days']=$Temp_Array['Days']-1; } return $Temp_Array; } function mydate_format($datestamp){ $tzoffset = 0; if ($datestamp == "0000-00-00" || $datestamp=="0000-00-00 00:00:00" || $datestamp=="") { $sDate = ""; } else { list($date,$time) = explode(" ",$datestamp); list($year,$month,$day) = explode("-",$date); list($hour,$minute,$second) = explode(":",$time); $hour = $hour + $tzoffset; $tstamp = mktime($hour,$minute,$second,$month,$day,$year); $sDate = date("m/d/Y H:i",$tstamp); } return $sDate; } function mydateNtime_format($datestamp){ $tzoffset = 0; if ($datestamp == "0000-00-00" || $datestamp=="0000-00-00 00:00:00" || $datestamp=="") { $sDate = ""; } else { list($date,$time) = explode(" ",$datestamp); list($year,$month,$day) = explode("-",$date); list($hour,$minute,$second) = explode(":",$time); $hour = $hour + $tzoffset; $tstamp = mktime($hour,$minute,$second,$month,$day,$year); $sDate = date("m/d/Y",$tstamp); } return $sDate; } function myTime_format($datestamp){ $tzoffset = 0; if ($datestamp == "0000-00-00" || $datestamp=="0000-00-00 00:00:00" || $datestamp=="") { $sDate = ""; } else { list($date,$time) = explode(" ",$datestamp); list($year,$month,$day) = explode("-",$date); list($hour,$minute,$second) = explode(":",$time); $hour = $hour + $tzoffset; $tstamp = mktime($hour,$minute,$second,$month,$day,$year); $sDate = date("H:i",$tstamp); } return $sDate; } function MakeDate($datestamp) { if($datestamp!="") { list($month, $day, $year, $hour, $min) = split('[ :/.-]', $datestamp); //$tstamp=$year."-".$month."-".$day; if($month=="")$month=0; if($min=="")$min=0; $tstamp = mktime($hour,$min,0,$month,$day,$year); $sDate=date("Y-m-d H:i",$tstamp); } else { $sDate="0000-00-00"; } return $sDate; } function getDialerStatus() { require("./connect.php"); $SelectQuery = "SELECT statusname,statusvalue FROM statusdetail order by statusvalue "; // run query if($results = MYSQL_query($SelectQuery,$connect)) { $Tmp_Array = array(); $counter=0; while ($row = MYSQL_fetch_array($results)) { $value = $row['statusvalue']; $Tmp_Array[$value]['Name'] = $row['statusname']; $counter++; } MYSQL_close($connect); } else { MYSQL_close($connect); die("Could not connect <br>$SelectQuery"); }// end if else return $Tmp_Array; } function getDialerStatusSRMC() { require("./connectProc.php"); $SelectQuery = "SELECT name,value FROM mccallstatus order by value "; // run query if($results = MYSQL_query($SelectQuery,$connect)) { $Tmp_Array = array(); $counter=0; while ($row = MYSQL_fetch_array($results)) { $value = $row['value']; $Tmp_Array[$value]['Name'] = $row['name']; $counter++; } MYSQL_close($connect); } else { MYSQL_close($connect); die("Could not connect <br>$SelectQuery"); }// end if else return $Tmp_Array; } function convertFloat($strValue) { $floatValue = ereg_replace("(^[0-9]*)(\\.|,)([0-9]*)(.*)", "\\1,\\3", $strValue); if (!is_numeric($floatValue)) $floatValue = ereg_replace("(^[0-9]*)(.*)", "\\1", $strValue); if (!is_numeric($floatValue)) $floatValue = 0; return $floatValue; } function strtflt($str) { $il = strlen($str); $flt = ""; $cstr = ""; for($i=0;$i<$il;$i++) { $cstr = substr($str, $i, 1); if(is_numeric($cstr) || $cstr == ".") $flt = $flt.$cstr; } return floatval($flt); } ?>

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)
8.3.60.0140.00416.63
8.3.50.0160.00821.99
8.3.40.0040.01218.80
8.3.30.0110.00419.09
8.3.20.0060.00320.29
8.3.10.0050.00322.03
8.3.00.0030.00619.16
8.2.180.0100.01018.25
8.2.170.0110.00422.96
8.2.160.0110.00420.70
8.2.150.0060.00324.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0030.00621.00
8.2.110.0030.00719.58
8.2.100.0120.00017.50
8.2.90.0000.00819.07
8.2.80.0000.00817.97
8.2.70.0030.00617.50
8.2.60.0040.00417.80
8.2.50.0030.00618.07
8.2.40.0030.00518.03
8.2.30.0030.00518.04
8.2.20.0030.00617.77
8.2.10.0000.00817.92
8.2.00.0040.00417.99
8.1.280.0070.00725.92
8.1.270.0040.00420.34
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0000.00922.80
8.1.230.0110.00017.42
8.1.220.0060.00317.74
8.1.210.0050.00318.77
8.1.200.0030.00717.25
8.1.190.0040.00417.13
8.1.180.0000.00818.10
8.1.170.0000.00818.59
8.1.160.0000.00721.97
8.1.150.0040.00418.91
8.1.140.0060.00317.35
8.1.130.0000.00717.91
8.1.120.0040.00417.54
8.1.110.0080.00017.52
8.1.100.0040.00417.51
8.1.90.0000.00817.50
8.1.80.0000.00817.36
8.1.70.0000.00917.43
8.1.60.0000.00917.59
8.1.50.0040.00417.58
8.1.40.0000.00917.54
8.1.30.0060.00317.68
8.1.20.0000.00817.58
8.1.10.0030.00617.41
8.1.00.0000.00817.52
8.0.300.0050.00318.77
8.0.290.0040.00416.63
8.0.280.0040.00418.42
8.0.270.0000.00717.27
8.0.260.0000.00717.28
8.0.250.0040.00416.89
8.0.240.0050.00216.97
8.0.230.0040.00416.93
8.0.220.0040.00416.96
8.0.210.0040.00416.91
8.0.200.0000.00816.98
8.0.190.0060.00616.89
8.0.180.0040.00416.82
8.0.170.0050.00316.97
8.0.160.0040.00416.91
8.0.150.0080.00016.85
8.0.140.0000.00816.77
8.0.130.0060.00013.40
8.0.120.0030.00516.92
8.0.110.0000.00816.82
8.0.100.0000.00716.80
8.0.90.0000.00816.87
8.0.80.0100.00716.92
8.0.70.0040.00416.79
8.0.60.0040.00416.79
8.0.50.0000.00716.98
8.0.30.0140.00616.81
8.0.20.0130.00717.40
8.0.10.0000.00717.02
8.0.00.0070.01316.75
7.4.330.0000.00515.03
7.4.320.0030.00316.52
7.4.300.0000.00616.63
7.4.290.0000.00716.68
7.4.280.0000.00716.42
7.4.270.0000.00716.43
7.4.260.0040.00416.64
7.4.250.0040.00416.48
7.4.240.0020.00616.62
7.4.230.0040.00416.68
7.4.220.0160.00716.54
7.4.210.0100.00616.70
7.4.200.0000.00716.70
7.4.160.0050.01116.41
7.4.150.0120.00617.40
7.4.140.0220.00917.86
7.4.130.0060.01516.53
7.4.120.0140.00616.46
7.4.110.0110.00716.41
7.4.100.0060.01416.40
7.4.90.0150.00416.52
7.4.80.0070.01119.39
7.4.70.0060.01616.62
7.4.60.0070.01016.53
7.4.50.0040.00016.43
7.4.40.0030.01416.52
7.4.30.0070.01016.38
7.4.00.0000.01514.75
7.3.330.0000.00613.23
7.3.320.0000.01413.32
7.3.310.0070.00016.14
7.3.300.0050.00216.21
7.3.290.0090.00716.30
7.3.280.0080.01016.30
7.3.270.0110.00717.40
7.3.260.0130.01516.68
7.3.250.0110.00716.36
7.3.240.0070.01016.62
7.3.230.0170.00616.39
7.3.210.0140.00316.44
7.3.200.0080.01219.39
7.3.190.0080.00816.44
7.3.180.0070.01316.48
7.3.170.0120.00616.50
7.3.160.0090.00616.29
7.2.330.0000.01816.76
7.2.320.0150.00616.65
7.2.310.0100.00716.69
7.2.300.0100.00616.52
7.2.290.0140.00616.66
7.2.00.0070.01419.05
7.1.100.0000.01017.91
7.1.70.0030.00916.69
7.1.60.0120.00919.50
7.1.50.0120.01216.54
7.1.00.0000.08022.29
7.0.200.0070.00016.67
7.0.100.0070.08020.09
7.0.90.0200.06720.02
7.0.80.0030.05320.06
7.0.70.0030.08320.08
7.0.60.0170.07020.07
7.0.50.0030.08020.36
7.0.40.0070.07320.05
7.0.30.0070.08719.95
7.0.20.0030.07019.95
7.0.10.0100.08020.12
7.0.00.0130.07320.08
5.6.280.0000.07321.21
5.6.250.0130.04720.68
5.6.240.0100.08320.73
5.6.230.0070.08320.77
5.6.220.0070.05720.73
5.6.210.0100.08020.84
5.6.200.0070.08321.27
5.6.190.0070.08321.16
5.6.180.0030.05021.06
5.6.170.0100.07021.11
5.6.160.0070.08321.11
5.6.150.0170.07321.25
5.6.140.0230.07021.18
5.6.130.0070.08021.02
5.6.120.0100.08321.16
5.6.110.0030.08321.12
5.6.100.0000.09021.18
5.6.90.0170.06321.09
5.6.80.0170.07020.49
5.6.70.0100.06020.42
5.6.60.0030.05720.34
5.6.50.0130.06720.55
5.6.40.0030.05320.39
5.6.30.0170.06720.42
5.6.20.0130.07020.56
5.6.10.0070.05020.35
5.6.00.0100.08020.54
5.5.380.0130.06720.50
5.5.370.0070.07720.43
5.5.360.0100.04720.44
5.5.350.0100.08020.48
5.5.340.0070.05020.86
5.5.330.0100.07720.92
5.5.320.0100.04320.95
5.5.310.0100.07721.02
5.5.300.0170.04020.96
5.5.290.0070.06720.95
5.5.280.0130.07320.86
5.5.270.0030.09321.00
5.5.260.0100.05720.99
5.5.250.0130.07720.82
5.5.240.0100.08020.24
5.5.230.0070.04720.29
5.5.220.0030.08320.32
5.5.210.0100.07720.24
5.5.200.0100.07020.22
5.5.190.0070.07320.35
5.5.180.0100.07320.27
5.5.160.0100.07320.24
5.5.150.0170.05020.20
5.5.140.0100.08020.32
5.5.130.0100.07320.28
5.5.120.0170.07320.24
5.5.110.0000.07720.32
5.5.100.0130.05720.00
5.5.90.0070.07320.19
5.5.80.0130.07320.15
5.5.70.0230.06320.14
5.5.60.0130.07020.11
5.5.50.0030.07720.14
5.5.40.0070.07720.02
5.5.30.0070.07320.14
5.5.20.0130.07320.09
5.5.10.0170.07020.07
5.5.00.0030.08320.06
5.4.450.0130.07319.46
5.4.440.0100.07319.38
5.4.430.0070.05019.37
5.4.420.0170.06019.22
5.4.410.0130.07019.10
5.4.400.0000.08019.15
5.4.390.0100.07319.04
5.4.380.0000.08018.97
5.4.370.0030.07718.87
5.4.360.0000.08319.17
5.4.350.0100.07719.14
5.4.340.0170.04319.05
5.4.320.0200.03719.20
5.4.310.0000.08019.24
5.4.300.0070.08019.05
5.4.290.0070.06719.13
5.4.280.0000.05719.13
5.4.270.0130.06719.16
5.4.260.0070.07719.05
5.4.250.0100.07019.13
5.4.240.0070.07018.86
5.4.230.0000.05019.05
5.4.220.0130.07719.19
5.4.210.0070.07319.02
5.4.200.0100.07719.04
5.4.190.0100.06019.21
5.4.180.0070.07019.15
5.4.170.0100.07019.16
5.4.160.0000.07719.15
5.4.150.0130.07019.12
5.4.140.0030.04716.48
5.4.130.0070.07716.47
5.4.120.0030.07016.45
5.4.110.0070.07316.57
5.4.100.0070.06716.45
5.4.90.0100.06716.53
5.4.80.0100.04016.52
5.4.70.0030.07016.54
5.4.60.0030.07716.38
5.4.50.0030.05316.36
5.4.40.0070.07316.46
5.4.30.0000.07716.51
5.4.20.0130.06316.45
5.4.10.0100.03716.36
5.4.00.0130.06715.85

preferences:
96.58 ms | 401 KiB | 5 Q