Created
August 23, 2014 05:18
-
-
Save yunchih/596b5d47cfb403153234 to your computer and use it in GitHub Desktop.
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 = array(); | |
$B = array(); | |
$C = array(); | |
echo 'Array A :<br/>'; | |
for($i=0;$i<10;$i++){ | |
$random = rand(1,30); | |
array_push($A, $random); | |
echo $random . " "; | |
} | |
echo '<br>'; | |
/*------------------*/ | |
for($i=0;$i<10;$i++){ | |
$current_number = $A[$i]; | |
if($current_number>15){ | |
array_push($B,$current_number); | |
} | |
else{ | |
array_push($C,$current_number); | |
} | |
} | |
echo 'Array B:<br/>'; | |
for ($i=0; $i < count($B); $i++) { | |
echo $B[$i] . " "; | |
} | |
echo '<br/>'; | |
/*----------------------------*/ | |
echo 'Array C:<br/>'; | |
for ($i=0; $i < count($C); $i++) { | |
echo $C[$i] . " "; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment