[Solved] Create a new array which have non matching values of two arrays without using any native function of PHP [closed]


Without using array function.

    function uniqueArray($array1,$array2) {
        $result = array();
        foreach($array1 as $val1) { //Array1 - Array2
            $flag = 0;
            foreach($array2 as $val2) {
              if($val1 == $val2){
                  $flag = 1;
                  break;
              }
            }
            if($flag == 0) {
                $result[] = $val1;
            }
        }
        foreach($array2 as $val1) { //Array2 - Array1
            $flag = 0;
            foreach($array1 as $val2) {
              if($val1 == $val2){
                  $flag = 1;
                  break;
              }
            }
            if($flag == 0) {
                $result[] = $val1;
            }
        }
        return $result;
    }

solved Create a new array which have non matching values of two arrays without using any native function of PHP [closed]