I’m using automatic php class to gets the keywords from my website page content
and the out put is exactly like
$text = "blah word1 blah word2 blah word3 blah"
$keywords = "word1, word2, word3";

and let suppose i’ve
$url = "http://www.some_site.com";
Now i’ve gonna convert all that keywords that inside my text content into links by adding those keywords into array as follow
$keyword_array = array(
"word1" => $url,
"word2" => $url,
"word3" => $url
);
The question now is how then to convert
$keywords = "word1, word2, word3";
into
$keyword_array = array(
"word1" => $url",
"word2" => $url,
"word3" => $url
);
since content and keywords indeed differ from page to page and can’t do manually !
I’ve been thinking of using explode for $keywords but i don’t know how to do it
any help ~ thanks
Assuming that the URL is the same for all keywords:
As an added bonus, this will work correctly regardless of the presence of spaces near the commas in the keyword list.
See it in action.