3v4l.org

run code in 300+ PHP versions simultaneously
<?php class AC { function actionClosest_AddPointsToResponse() { $points = array(); $res_pnt = 0; $timestamp = 0; $more_records = false; $matching = array( 'Payments' => 'payment2=extract(%item, %id, "DP_Payment", "dpp_id", "dpp_", array("dpp_id"), true, true, true)', /* 'dp_id_uniq' => 'id', 'dp_update' => 'update', 'dp_type' => 'point|type', 'dp_name' => 'point|name', 'dp_description' => 'point|description', 'dp_currency' => 'point|currency', 'dp_company_id' => 'point|company_id', 'dp_tariff_plan' => 'point|tariff_plan', 'PhoneNumbers' => 'point|phone_nums=get(%item, %id, "DP_Phone", "dp_id", "dp_", array("ph_id", "dp_id"), false, false, true, 0)', 'WorkingHours' => 'point|work_hours=get(%item, %id, "DP_WorkingHour", "dp_id", "dp_", array("dp_id"))', 'dp_slot_duration' => 'point|slot_duration', 'dp_slot_number' => 'point|slot_number', 'dp_latitude' => 'geo|latitude', 'dp_longitude' => 'geo|longitude', 'dp_country' => 'geo|country_id', 'dp_region' => 'geo|region', 'dp_city' => 'geo|city', 'dp_post_code' => 'geo|post_code', 'dp_street' => 'geo|street', 'dp_house_number' => 'geo|house_number', 'ServiceList' => 'service|main_service=get(%item, %id, "DP_ServicePrice", "dp_id", "sv_", array("dp_id", "sv_price", "price_schema=>price"))', 'dp_additional_service' => 'service|additional_service', 'Payments' => 'payment=extract(%item, %id, "DP_Payment", "dpp_id", "dpp_", array("dpp_id"), true, true, true)', 'PrepaidCards' => 'payment|prepaid_cards=get(%item, %id, "DP_PrepaidCard", "dp_id", "dp_", array("ppc_id", "dp_id"), false, true, false)', 'Parking' => 'parking=get(%item, %id, "DP_Parking", "parking_id", "parking_", array("parking_id"), true, true)', 'CarWash' => 'car_wash=get(%item, %id, "DP_CarWash", "cw_id", "cw_", array("cw_id", "cw_subcompact_cars", "cw_compact_cars", "cw_suv_minivans", "cw_trucks", "cw_cleaning_method"), true, true)', 'TyreFitting' => 'tyre_fitting=get(%item, %id, "DP_TyreFitting", "tf_id", "tf_", array("tf_id", "tf_install_wheel", "tf_mount_tyres", "tf_wheel_balancing", "tf_tyre_fitting_wheel", "tf_tyre_fitting_car", "tf_disc_repair", "tf_tyre_repair", "tf_inflation", "tf_run_flat_repair", "tf_tyres_recycling", "tf_tyres_storage"), true, true)', 'ParkingCapacity' => 'payment=get(%item, %id, "DP_ParkingCapacity", "parking_id", "pc_", array("parking_id"), true, true)', #'' => '', '' => '', '' => '', #'CarService' => '', */ ); $var = ''; $item = array(); $drevolpoint_id = 2; //$point->dp_id; foreach( $matching as $param => $match ) { if (!preg_match('/^(\w+)(?:\|(\w+))?(?:=(get|extract)\((.*?)\))?$/', $match, $var)) throw new Exception("Unknown DB field mappint: $match (for $param)"); if (!in_array($param, array_keys($point->attributes)) and (!isset($var[4]) or !$var[4])) throw new Exception("Unknown DB field requested: $param (matching for $match)"); $item_name = '$item[\''.$var[1].'\']'; if (isset($var[2]) and $var[2]) $item_name .= '[\''.$var[2].'\']'; print("<hr>Item name = '$item_name'<br>\n"); } } } $aco = new AC; $aco->actionClosest_AddPointsToResponse();
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: Undefined variable $point in /in/cMSsQ on line 39 Warning: Attempt to read property "attributes" on null in /in/cMSsQ on line 39 Fatal error: Uncaught TypeError: array_keys(): Argument #1 ($array) must be of type array, null given in /in/cMSsQ:39 Stack trace: #0 /in/cMSsQ(39): array_keys(NULL) #1 /in/cMSsQ(52): AC->actionClosest_AddPointsToResponse() #2 {main} thrown in /in/cMSsQ on line 39
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: point in /in/cMSsQ on line 39 Notice: Trying to get property 'attributes' of non-object in /in/cMSsQ on line 39 Warning: array_keys() expects parameter 1 to be array, null given in /in/cMSsQ on line 39 Warning: in_array() expects parameter 2 to be array, null given in /in/cMSsQ on line 39 <hr>Item name = '$item['payment2']'<br>
Output for 7.3.32 - 7.3.33
Warning: array_keys() expects parameter 1 to be array, null given in /in/cMSsQ on line 39 Warning: in_array() expects parameter 2 to be array, null given in /in/cMSsQ on line 39 <hr>Item name = '$item['payment2']'<br>
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33
Notice: Undefined variable: point in /in/cMSsQ on line 39 Notice: Trying to get property of non-object in /in/cMSsQ on line 39 Warning: array_keys() expects parameter 1 to be array, null given in /in/cMSsQ on line 39 Warning: in_array() expects parameter 2 to be array, null given in /in/cMSsQ on line 39 <hr>Item name = '$item['payment2']'<br>
Output for 5.0.4 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Notice: Undefined variable: point in /in/cMSsQ on line 39 Notice: Trying to get property of non-object in /in/cMSsQ on line 39 Warning: array_keys(): The first argument should be an array in /in/cMSsQ on line 39 Warning: in_array(): Wrong datatype for second argument in /in/cMSsQ on line 39 <hr>Item name = '$item['payment2']'<br>
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: point in /in/cMSsQ on line 39 Notice: Trying to get property of non-object in /in/cMSsQ on line 39 Warning: array_keys(): The first argument should be an array in /in/cMSsQ on line 39 Warning: in_array(): Wrong datatype for second argument in /in/cMSsQ on line 39 <hr>Item name = '$item['payment2']'<br>
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_NEW in /in/cMSsQ on line 37
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_NEW in /in/cMSsQ on line 37
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/cMSsQ on line 37
Process exited with code 255.

preferences:
303.27 ms | 401 KiB | 459 Q