Add .com to end of my string in php <p>What I'm trying to is search my string to see if there is any of the following arrays there</p> <p>if not then we need to add .com to end of it.</p> <p>$kwlines is my string and i have set it to test but this is what I get </p> <blockquote> <p>test.comtest.com.comtest.com.com.comtest.com.com.com.comtest.com.com.com.com.comtest.com.com.com.com.com.comtest.com.com.com.com.com.com.com</p> </blockquote> <pre><code>foreach ($kwlines as $kw) { $owned_urls= array('.com', '.co.uk', '.net','.org', '.gov','.gov.co.uk','.us'); foreach ($owned_urls as $url) { if (strpos($kw, $url) !== TRUE) { $kw .= ".com"; echo "$kw"; } } </code></pre> <p>Could you please help me understand what I do wrong?</p> <p>Thank you</p>