Q:

how to use str_replace with array

I have this string:
Name: Ali [[BOOK]] 
Name: Maer [[BOOK]] 
Name: John [[BOOK]]

And this array:
<pre>Array ( [0] => Story [1] => Newspaper [2] => Mag ) </pre>

I want to replace [[BOOK]] with array values.

A:

Explanation
First you need to search inside array which element you want to replace.
str_replace function accept arguments. eg.
$arr = array("Story","Newspaper","Mag");

For example,You want to replace the Story to timeline.
str_replace("Story","timeline",$arr);

