3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $categories=Array ( "1" => "Accounting & Financial", "2" => "Advertising Services", "3" => "Awards & Incentives", "4" => "Business Consultants", "5" => "Career Services", "6" => "Creative Services", "7" => "Data Management", "8" => "Distributors & Agents" ) ; $Service_Provider_Id['Category'] = Array ( "0" => Array ( "id" => "1" , "category" => "Accounting & Financial" ), "1" => Array ( "id" => "2", "category" => "Advertising Services" ) ); ?> <?php foreach ($categories as $key => $value) { ?> <div class="checkboxes-div"> <input type="checkbox" id="CategoryCategory<?php echo $key; ?>" value="<?php echo $key?>" name="data[Category][Category][]" <?php foreach ($Service_Provider_Id['Category'] as $keys => $values) { foreach ($values as $keys2 => $values2) { if(in_array($value,$Service_Provider_Id['Category'][$keys])) { ?> checked <?php } } } ?> > <label class="selected" for="CategoryCategory<?php echo $value; ?>"> <?php echo $value; ?> </label> </div> <?php } ?>
Output for 4.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
<div class="checkboxes-div"> <input type="checkbox" id="CategoryCategory1" value="1" name="data[Category][Category][]" checked checked > <label class="selected" for="CategoryCategoryAccounting & Financial"> Accounting & Financial </label> </div> <div class="checkboxes-div"> <input type="checkbox" id="CategoryCategory2" value="2" name="data[Category][Category][]" checked checked > <label class="selected" for="CategoryCategoryAdvertising Services"> Advertising Services </label> </div> <div class="checkboxes-div"> <input type="checkbox" id="CategoryCategory3" value="3" name="data[Category][Category][]" > <label class="selected" for="CategoryCategoryAwards & Incentives"> Awards & Incentives </label> </div> <div class="checkboxes-div"> <input type="checkbox" id="CategoryCategory4" value="4" name="data[Category][Category][]" > <label class="selected" for="CategoryCategoryBusiness Consultants"> Business Consultants </label> </div> <div class="checkboxes-div"> <input type="checkbox" id="CategoryCategory5" value="5" name="data[Category][Category][]" > <label class="selected" for="CategoryCategoryCareer Services"> Career Services </label> </div> <div class="checkboxes-div"> <input type="checkbox" id="CategoryCategory6" value="6" name="data[Category][Category][]" > <label class="selected" for="CategoryCategoryCreative Services"> Creative Services </label> </div> <div class="checkboxes-div"> <input type="checkbox" id="CategoryCategory7" value="7" name="data[Category][Category][]" > <label class="selected" for="CategoryCategoryData Management"> Data Management </label> </div> <div class="checkboxes-div"> <input type="checkbox" id="CategoryCategory8" value="8" name="data[Category][Category][]" > <label class="selected" for="CategoryCategoryDistributors & Agents"> Distributors & Agents </label> </div>
Output for hhvm-3.10.0

Process exited with code 153.