3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @file requestUserInfo.php * @TIME * @brief Brief * @Author Author * @Website www.lotto-pass.cn * */ define('IN_ECS', true); //echo "<p>in request:"; //print_r($_POST); $current_path = dirname(__FILE__); $base_path = substr($current_path, 0, strlen($current_path) - strlen("/webservice")); require_once($base_path . '/includes/init.php'); require_once(ROOT_PATH . 'includes/cls_json.php'); require_once(ROOT_PATH . 'includes/lib_common.php'); // echo "<p>After include:"; require_once (ROOT_PATH . 'includes/utilities/dbutilities.php'); require_once (ROOT_PATH . 'includes/webservice/webserviceutilities.php'); require_once (ROOT_PATH . 'includes/utilities/userUtilities.php'); $device_id = getHttpRequest("device_id"); $trans_time = getHttpRequest("trans_time"); $card_number = getHttpRequest("card_number"); $sessionId = getHttpRequest("sessionId"); $sessionTime = getHttpRequest("sessionTime"); $min_required_points = getHttpRequest("mpb"); $check_sum = getHttpRequest("checksum"); $check_sum_array = ( "device_id" => $device_id, "trans_time" => $trans_time, "card_number" => $card_number, "sessionId" => $sessionId, "sessionTime" => $sessionTime, "mpb" => $min_required_points, "checksum" => $check_sum ); $check_sum_str = constructHttpParameters($check_sum_array); $resultcode = 0; $xml_string = ""; $update_data = array(); $log_date = array(); $post_data = array(); $min_factor1=5; //最低积分的倍数; $min_factor2=10; $transfer_factor1 = 0; // Not enough, no transfer $transfer_factor2 = 1; // Very low, send everything that enough for purchase $transfer_factor3 = 2; // Not enough for 10 purchases, send half of the points $transfer_factor4 = 10; // Sufficient, send points for 10 purchases. $exist_card_number = 0; $post_data['sessionId'] = $sessionId; $post_data['device_id'] = $device_id; $post_data['trans_time'] = $trans_time; $post_data['mpb'] = $min_required_points; $post_data['user_id'] = ""; $post_data['user_name'] = ""; $post_data['alias'] = "";//urlencode($alias); $post_data['display_user_points'] = 0; $post_data['message'] = ""; $post_data['transfer_points'] = 0; $post_data['user_points'] = 0; $post_data['fund_status'] = 100; //100 means not enough fund // Retrieve the jackpot related information and messages $jackpot_table_name = "jackpot_award"; $jackpot_key = "add_time"; $jackpot_sql_result = selectLastRecord($jackpot_key, $jackpot_table_name); while($sql_data = mysql_fetch_array($jackpot_sql_result, MYSQL_ASSOC)){ // echo "<p>The sql_result:"; // print_r($sql_data); $jackpot_amount = $sql_data['jackpot_amount']; $jackpot_ceiling = $sql_data['jackpot_ceiling']; $jackpot_preserved = $sql_data['jackpot_preserved']; $message_front = $sql_data['message_front']; $message_mid = $sql_data['message_mid']; $message_end = $sql_data['message_end']; $message_top = $sql_data['message_top']; //echo "The messages:".$message_front."-".$message_mid."-".$message_end."-".$message_top; $jackpot_data['jackpot_amount'] = $jackpot_amount; $jackpot_data['jackpot_ceiling'] = $jackpot_ceiling; $jackpot_data['jackpot_preserved'] = $jackpot_preserved; $jackpot_data['message_front'] = $message_front; $jackpot_data['message_mid'] = $message_mid; $jackpot_data['message_end'] = $message_end; $jackpot_data['message_top'] = $message_top; $post_data['Jackpot'] = $jackpot_data; } mysql_free_result($sql_result); // echo "<p>The post data:"; // print_r($post_data); if (checkBcc($check_sum_str, $check_sum)) { if (!existSessionId($sessionId, $sessionTime)) { // Retrieve the user information and the points from database $table_name = "users"; $conditions = "card_number = ".$card_number; $sql_result = selectConditionalRecords($conditions, $table_name); while($sql_data = mysql_fetch_array($sql_result, MYSQL_ASSOC)){ // echo "<p>The sql_result:"; // print_r($sql_data); $exist_card_number++; $user_id = $sql_data['user_id']; $user_name = $sql_data['user_name']; $alias = $sql_data['alias']; $current_user_points = abs($sql_data['user_points']); $current_frozen_points = abs($sql_data['frozen_points']); $post_data['user_id'] = $user_id; $post_data['user_name'] = $user_name; $post_data['alias'] = $alias; $post_data['display_user_points'] = abs(intval($current_user_points)); $usable_points = $current_user_points - $current_frozen_points; // echo "<p>usable_points:".$usable_points; switch ($usable_points) { case ($usable_points < $min_required_points) : // echo "<p>case: 100"; $post_data['message'] = "剩余积分不足, 请充值后再继续。"; //$usable_points = 0; $transfer_points = $usable_points * $transfer_factor1; $user_points = $current_user_points; $frozen_points = $current_frozen_points + $transfer_points; $post_data['transfer_points'] = abs(intval($transfer_points)); $post_data['user_points'] = abs(intval($user_points)); $post_data['fund_status'] = 100; //100 means not enough fund break; case ($usable_points >= $min_required_points and $usable_points <= $min_required_points*$min_factor1) : // echo "<p>case: 200"; $post_data['message'] = "剩余积分很低,请速充值。"; $transfer_points = round($usable_points/($min_required_points * $transfer_factor2),0)*$min_required_points; while ($transfer_points > $usable_points) { $transfer_points = $transfer_points - $min_required_points; } $frozen_points = $current_frozen_points + $transfer_points; $user_points = $current_user_points - $transfer_points; // echo "<p> transfer_points:".$transfer_points; $post_data['frozen_points'] = abs(intval($frozen_points)); $post_data['transfer_points'] = abs(intval($transfer_points)); $post_data['user_points'] = abs(intval($user_points)); $post_data['fund_status'] = 200; //200 means very low fund break; case ($usable_points > $min_required_points*$min_factor1 and $usable_points <= $min_required_points*$min_factor2) : // echo "<p>case: 300"; $post_data['message'] = "剩余积分低,请速充值。"; $transfer_points = round($usable_points /($min_required_points * $transfer_factor3),0)*$min_required_points; while ($transfer_points > $usable_points) { $transfer_points = $transfer_points - $min_required_points; } $frozen_points = $current_frozen_points + $transfer_points; $user_points = $current_user_points - $transfer_points; // echo "<p> transfer_points:".$transfer_points; $post_data['frozen_points'] = abs(intval($frozen_points)); $post_data['transfer_points'] = abs(intval($transfer_points)); $post_data['user_points'] = abs(intval($user_points)); $post_data['fund_status'] = 300; //300 means low fund break; case ($usable_points >= $min_required_points*$min_factor4) : // echo "<p>case: default"; $post_data['message'] = "感谢参与公益购彩。"; $transfer_points = $min_required_points*$transfer_factor4; $frozen_points = $current_frozen_points + $transfer_points; $user_points = $current_user_points - $transfer_points; // echo "<p> transfer_points:".$transfer_points; $post_data['frozen_points'] = abs(intval($frozen_points)); $post_data['transfer_points'] = abs(intval($transfer_points)); $post_data['user_points'] = abs(intval($user_points)); $post_data['fund_status'] = 1000; //1000 means sufficient fund break; default : // echo "<p>case: 0"; $post_data['message'] = "无法获取有效积分,请重试。"; $usable_points = 0; $transfer_points = 0; $user_points = 0; $post_data['transfer_points'] = 0; $post_data['user_points'] = 0; $post_data['fund_status'] = 0; //0 means not processed } } mysql_free_result($sql_result); // print_r($post_data); // Update if ($exist_card_number > 0) { $post_data['card_number'] = $card_number; $user_point_change = - $transfer_points; $frozen_points_change = $transfer_points; $change_desc = "可用积分".$usable_points.",向".$device_id."上划拨".$frozen_points."积分,资金状态".$post_data['fund_status']; log_account_change($user_id, 0, 0, 0, $user_point_change, $frozen_points_change, 0, 0, $change_desc); $resultcode = 1; $post_data['status'] = $resultcode; // Check if there is any voucher need to be printed for this user. $voucher_table_name = "active_vouchers"; $conditions = "user_id = ".$user_id." AND status = 0"; $voucher_sql_result = selectConditionalRecords($conditions, $voucher_table_name);; while($sql_data = mysql_fetch_array($voucher_sql_result, MYSQL_ASSOC)){ // echo "<p>The sql_result:"; // print_r($sql_data); $voucher_id = $sql_data['id']; $voucher_template_id = $sql_data['voucher_id']; $qr_message = $sql_data['qr_message']; $voucher_message = $sql_data['message']; $voucher_data['voucher_id'] = $voucher_id; $voucher_data['voucher_template_id'] = $voucher_template_id; $voucher_data['qr_message'] = $qr_message; $voucher_data['voucher_message'] = $voucher_message; $post_data['Coupon'] = $voucher_data; } mysql_free_result($sql_result); } else { $post_data['card_number'] = -1; } $xml_string = getArrayToXML($post_data); //echo $xml_string; $dbStatus = setSessionId($sessionId, $sessionTime, $frozen_points, $xml_string); // echo "<p> The XML_data:".$xml_string; } else { $resultcode = 2;//重发 $xml_string = getTransferred($sessionId, $sessionTime); } } else { $resultcode = 0; } header("Expires: date('Y-m-d H:i:s')"); echo $xml_string; ?>

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.6.80.0070.04720.53
5.5.240.0100.05720.19
5.4.400.0300.03718.62
5.4.390.0170.05318.52
5.4.380.0200.05318.46
5.4.370.0230.07018.59
5.4.360.0230.06718.84
5.4.350.0300.06318.46
5.4.340.0270.04718.54
5.4.320.0100.06018.71
5.4.310.0130.06718.79
5.4.300.0200.05018.77
5.4.290.0230.04718.57
5.4.280.0130.06018.75
5.4.270.0100.06018.73
5.4.260.0170.05018.51
5.4.250.0100.06018.55
5.4.240.0230.06018.76
5.4.230.0130.05718.81
5.4.220.0070.06318.57
5.4.210.0130.06018.76
5.4.200.0100.05716.80
5.4.190.0070.06018.71
5.4.180.0230.04718.55
5.4.170.0230.04718.50
5.4.160.0200.05318.73
5.4.150.0200.07018.77
5.4.140.0100.05316.22
5.4.130.0270.06316.27
5.4.120.0100.08016.30
5.4.110.0200.07016.17
5.4.100.0130.08016.43
5.4.90.0270.05716.14
5.4.80.0130.05716.43
5.4.70.0130.05316.21
5.4.60.0300.05716.26
5.4.50.0170.06716.21
5.4.40.0170.05016.27
5.4.30.0170.05016.27
5.4.20.0100.05716.27
5.4.10.0130.06016.29
5.4.00.0130.07315.64
5.3.290.0200.05014.72
5.3.280.0230.07014.52
5.3.270.0300.05014.66
5.3.260.0270.05014.61
5.3.250.0200.05314.59
5.3.240.0230.04714.57
5.3.230.0230.04714.51
5.3.220.0230.04314.55
5.3.210.0200.05714.48
5.3.200.0130.05314.54
5.3.190.0270.05014.57
5.3.180.0200.04714.57
5.3.170.0130.05014.59
5.3.160.0130.05014.62
5.3.150.0230.07014.54
5.3.140.0170.07714.47
5.3.130.0330.06314.67
5.3.120.0200.07314.65
5.3.110.0070.06014.64
5.3.100.0230.06014.14
5.3.90.0200.04713.95
5.3.80.0270.06314.09
5.3.70.0170.05714.01
5.3.60.0230.04314.00
5.3.50.0130.06013.89
5.3.40.0100.05313.85
5.3.30.0100.05313.86
5.3.20.0230.04013.69
5.3.10.0130.05013.64
5.3.00.0130.05313.66
5.2.170.0130.04311.21
5.2.160.0070.04311.20
5.2.150.0130.04011.21
5.2.140.0170.04311.18
5.2.130.0070.04311.05
5.2.120.0100.03711.07
5.2.110.0000.05011.15
5.2.100.0070.04311.14
5.2.90.0900.04011.08
5.2.80.0770.04011.17
5.2.70.0730.04311.02
5.2.60.0730.05011.07
5.2.50.0870.04311.00
5.2.40.0600.04011.01
5.2.30.0530.04710.97
5.2.20.0670.03311.12
5.2.10.0770.04010.97
5.2.00.0570.04310.87
5.1.60.0600.04010.02
5.1.50.0600.03710.03
5.1.40.0570.04310.00
5.1.30.0570.04010.50
5.1.20.0700.02310.39
5.1.10.0570.03310.18
5.1.00.0570.03710.20
5.0.50.0230.0378.55
5.0.40.0300.0308.46
5.0.30.0300.0438.26
5.0.20.0370.0208.28
5.0.10.0300.0378.32
5.0.00.0430.0378.21
4.4.90.0400.0135.90
4.4.80.0230.0275.90
4.4.70.0330.0235.87
4.4.60.0300.0235.95
4.4.50.0270.0235.93
4.4.40.0400.0405.90
4.4.30.0370.0275.84
4.4.20.0300.0275.91
4.4.10.0330.0275.98
4.4.00.0370.0305.96
4.3.110.0300.0235.90
4.3.100.0400.0135.85
4.3.90.0330.0275.80
4.3.80.0370.0435.79
4.3.70.0300.0205.79
4.3.60.0270.0235.82
4.3.50.0400.0235.82
4.3.40.0330.0375.90
4.3.30.0170.0234.70
4.3.20.0130.0234.57
4.3.10.0130.0234.50
4.3.00.0130.0237.51

preferences:
152.63 ms | 939 KiB | 8 Q