Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Original Arrays
- $a = array(0,1,2,3,4,5);
- $b = array(6,7,8,9,10);
- // Create an empty new array
- $ab = array();
- // Add all the values from array a to the new array
- foreach ($a as $value) {
- $ab[] = $value;
- }
- // Add all the values from array b to the new array
- foreach ($b as $value) {
- $ab[] = $value;
- }
- // Sort the array in ASC order
- sort($ab);
- // Print the new array
- echo '<pre>';
- print_r($ab);
- echo '</pre>';
Add Comment
Please, Sign In to add comment