Using "fwrite" in php

I hope u lot aint sick of me…
Basically, the code below creates a few variables. The 1st variable is called $index_str, inside this variable is a string of text and another variable inside it called “$var1”. The 2nd variable is called $pagetemp and it has all the contents from inside a file called pagetemp.php. The content of these two variables($index_str & $pagetemp) are then written into a new file called newPage.php.

Here’s the code:

 $index_str = "This is my string" . "
 $index_str .= "$var1 = \"is the variable I want to put into the new page\" . "
 $pagetemp = file_get_contents("pagetemp.php");
 $client_index = fopen("newPage.php", 'w+');
 fwrite($client_index, $index_str . "
" . $pagetemp);

Problem is… Once the new page is created, the variable $var1 is not shown… Can anyone help? I find it hard to word what I mean when I talk about all this coding stuff, so just ask if u want me to try and elaborate more.