Created
February 17, 2015 04:53
-
-
Save goldalworming/f951dc6b4d4d969a94e4 to your computer and use it in GitHub Desktop.
merge 2 array (not sorted)
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 | |
$max = 10; | |
$arr = range(1,$max,3); | |
$arr2 = range(1,$max,2); | |
$arr = array_merge($arr,$arr2); | |
$res2 = array(); | |
foreach($arr as $key=>$val) { | |
$res2[$val] = true; | |
} | |
$res2 = array_keys($res2); | |
echo "<br>"; | |
echo json_encode($res2); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment