<?php

$myArray = [
        array(
                "fname" => "Sudhir",
                "lname" => "Gour",
                "age" => 27,
                "city" => "Jaipur",
                "state" => "Jaipur",
                "country" => "India"
            ) ,
        array(
                "fname" => "Sudhir",
                "lname" => "Gour",
                "age" => 27,
                "city" => "Jaipur",
                "state" => "Jaipur",
                "country" => "India"
            )
    ];
    
    
// $input = array(
//     "name" => "Sudhir",
//     "ans" => true
// );
    
    
$input = array(
    "fname" => "Kamal",
    "lname" => "Gour",
    "age" => ,
    "city" => "Udaipur",
    "state" => "Rajasthan",
    "country" => "India"
);

// print_r(count(array_diff_key($myArray[0] , $input)));
// echo "\n";

if(count(array_diff_key($myArray[0] , $input)) != 0){
        echo("Keys don't match to perform array_push \n");
}
else{
    foreach ($input as $key => $value){
        if($value == ""){
            echo "A value at key : " . $key ." is required to perform an array_push.\n";
            die();
        }
    }
    
    array_push($myArray , $input);
    print_r($myArray);
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: