Skip to content

Instantly share code, notes, and snippets.

@goldalworming
Created February 17, 2015 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goldalworming/f951dc6b4d4d969a94e4 to your computer and use it in GitHub Desktop.
Save goldalworming/f951dc6b4d4d969a94e4 to your computer and use it in GitHub Desktop.
merge 2 array (not sorted)
<?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