使用file_put_contents的数组

Lets say I have 2 arrays .

$arr1=array("foo"=>"bar", 1=>"one", 2=>"two");
$arr2=array("h"=>"eich", 3=>"three", 4=>"four");

By using file_put_contents I am able to print the array into a new php file something like this :

<?php
$arr1 = Array
(
   "foo"=>"bar",
    1=>"one",
    2=>"two"
) //need a semicolon here 
$arr2 = Array
(
   "h"=>"eich",
    3=>"three",
    4=>"four"
)//need a semicolon here 

My question is , How can I get a semicolon after the end of each array ?

Because you even have this problem, I guess you are looping the arrays to convert them to PHP code and not using var_export() - which you should be:

$arr1 = array("foo"=>"bar", 1=>"one", 2=>"two");
$arr2 = array("h"=>"eich", 3=>"three", 4=>"four");

$file = "<?php

".var_export($arr1, TRUE).";

".var_export($arr2, TRUE).";
";

file_put_contents('newfile.php', $file);

See it working