3v4l.org

run code in 300+ PHP versions simultaneously
<?php $haystack=array( array("Term"=>"VATEXEMPT","EN"=>"Customer's declaration for VAT relief.","NL"=>" Verklaring van de klant voor BTW-vrijstelling."), array("Term"=>"VAT_LABEL","EN"=>"VAT Relief.","NL"=>" BTW verlichting."), array("Term"=>"PLEASE_SELECT","EN"=>"Please Select Accordingly.","NL"=>"Selecteer alstublieft."), array("Term"=>"CONFIRM","EN"=>"Yes. I confirm statement.","NL"=>"Ja. ik bevestig de verklaring."), array("Term"=>"DENIED","EN"=>"No. I'm not chronically sick or disabled.","NL"=>"Nee. ik ben niet chronisch ziek of gehandicapt."), array("Term"=>"BIRTHDAY_LBL","EN"=>"Birthday.","NL"=>"Geboortedag."), array("Term"=>"BIRTHDAY","EN"=>"You must be older than 12 years!.","NL"=>"Je moet ouder zijn dan 12 jaar!."), array("Term"=>"FirstName","EN"=>"Your first name.","NL"=>"Jouw voornaam."), array("Term"=>"LastName","EN"=>"Your last name.","NL"=>"Jouw achternaam."), array("Term"=>"FEMALE","EN"=>"Female.","NL"=>" Vrouw."), array("Term"=>"MALE","EN"=>"Male.","NL"=>" Man."), array("Term"=>"OTHER","EN"=>"Other.","NL"=>" Anders."), array("Term"=>"GENDER","EN"=>"Gender.","NL"=>" Geslacht."), array("Term"=>"SURVEY_LBL","EN"=>"May we contact you?.","NL"=>" Mogen we contact met u opnemen?."), array("Term"=>"SURVEY_DESC","EN"=>"I would like to get some feedback on the Medication vest and if you have any suggestions for improvement..","NL"=>" Ik zou graag wat feedback krijgen over het medicatie-vest en of je suggesties voor verbetering hebt."), array("Term"=>"PHONE_CONTACT","EN"=>"Yes. by phone.","NL"=>" Ja. telefonisch."), array("Term"=>"EMAIL_CONTACT","EN"=>"Yes. by email.","NL"=>" Ja. per e-mail."), array("Term"=>"CONTACT_NO","EN"=>"No. don't contact me.","NL"=>" Nee. neem geen contact met mij op."), array("Term"=>"SUBSCRIBE","EN"=>"Subscribe me for Discount and News.","NL"=>" Abonneer me voor korting en nieuws."), array("Term"=>"FAV_COL","EN"=>"Favourite colour.","NL"=>" Favoriete kleur."), array("Term"=>"FAV_COL_DESC","EN"=>"Your favourite colour for the Medication Vest.","NL"=>" Je favoriete kleur voor het medicatie-vest."), array("Term"=>"BLACK","EN"=>"Black.","NL"=>" Zwart."), array("Term"=>"WHITE","EN"=>"White.","NL"=>"Wit."), array("Term"=>"GREY","EN"=>"Grey.","NL"=>" Grijs."), array("Term"=>"DARKBLUE","EN"=>"Dark Blue.","NL"=>" Donker blauw."), array("Term"=>"SKIN","EN"=>"Skin tone.","NL"=>" Huidskleur."), array("Term"=>"NOT_LISTED","EN"=>"Not listed.","NL"=>" Staat er niet bij."), array("Term"=>"PROFILE_IMG","EN"=>"Profile Picture.","NL"=>" Profielfoto."), array("Term"=>"PROFILE_IMG_DESC","EN"=>"Paste your link to your online profile picture.","NL"=>" Plak je link naar je online profielfoto."), array("Term"=>"YES","EN"=>"Yes.","NL"=>" Ja."), array("Term"=>"NO","EN"=>"No.","NL"=>" Nee.") ); function searchForId("PLEASE_SELECT", $haystack, $id_path) { // Iterating over main array foreach ($haystack as $key1 => $val1) { $temp_path = $id_path; // Adding current key to search path array_push($temp_path, $key1); // Check if this value is an array // with atleast one element if(is_array($val1) and count($val1)) { // Iterating over the nested array foreach ($val1 as $key2 => $val2) { if($val2 == $search_value) { // Adding current key to search path array_push($temp_path, $key2); return join(" --> ", $temp_path); } } } elseif($val1 == $search_value) { return join(" --> ", $temp_path); } } return null; } , $id_path) { // Iterating over main array foreach ($haystack as $key1 => $val1) { $temp_path = $id_path; // Adding current key to search path array_push($temp_path, $key1); // Check if this value is an array // with atleast one element if(is_array($val1) and count($val1)) { // Iterating over the nested array foreach ($val1 as $key2 => $val2) { if($val2 == $search_value) { // Adding current key to search path array_push($temp_path, $key2); return join(" --> ", $temp_path); } } } elseif($val1 == $search_value) { return join(" --> ", $temp_path); } } return null; }
Output for 7.1.25 - 7.1.28, 7.2.0 - 7.2.18, 7.3.0 - 7.3.5
Parse error: syntax error, unexpected '"PLEASE_SELECT"' (T_CONSTANT_ENCAPSED_STRING), expecting variable (T_VARIABLE) in /in/YGqXN on line 36
Process exited with code 255.

preferences:
172.99 ms | 1395 KiB | 36 Q