user3260392
user3260392

Reputation: 171

Merging several array values into 1 array

I have 4 arrays for input errors like:

$username_errors=array();
$email_errors=array();
$password_errors=array();
$errors=array();

I want to merge all the arrays values in $errors array and count if $errors is empty then proceed. Thanks in advance.

Upvotes: 0

Views: 40

Answers (2)

Unix von Bash
Unix von Bash

Reputation: 730

$array3 = array_merge($array1, $array2);

Upvotes: 0

Sabuj Hassan
Sabuj Hassan

Reputation: 39355

use array_merge

$arr = array_merge($arr1, $arr2, $arr3);

Upvotes: 1

Related Questions