Nothing, Just changed this "<?=json_encode($arr1)?>" to "<?php echo json_encode($arr1); ?>" to make it work. Because i'm using lower version of PHP in window OS so that. if you are executing in linux means it will work.
Here is the working code :
<script>
function testfunc(obj1,obj2)
{
var test1=JSON.parse(obj1);
alert(test1.el1);
}
</script>
<?php
$arr1 = array("el1"=>"1","el2"=>"2","el3"=>"3");
$arr2 = array("el21"=>"21","el22"=>"22");
?>
<button type="button" onclick='testfunc(JSON.stringify(<?php echo json_encode($arr1); ?>),JSON.stringify(<?php echo json_encode($arr2); ?>))'>Merge</button>
Note: in that function should be passed as value(number or string) or variable, can't pass json result, Because of syntax error.