Last active
August 29, 2015 14:05
-
-
Save mayeenulislam/8860d366138925178e7d to your computer and use it in GitHub Desktop.
Foreach Loop from Associative Array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// A simple foreach() loop from an array | |
$age_array = array( | |
'0-18' => '0 - 18', | |
'19-25' => '19 - 25', | |
'26-30' => '26 - 30', | |
'31-50' => '31 - 50', | |
'51-65' => '51 - 65', | |
'66-80' => '66 - 80', | |
'81-100' => '81 - 100', | |
'100+' => '100+' | |
); | |
foreach ( $age_array as $age => $string ) { | |
echo '<input type="radio" name="client_age" id="client_age" value="'. $age .'" /> '. $string .'<br>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment