I have a foreach loop with list of links, and I'm trying to remove the spaces in the strings because I'll be using it as an href. So far, I successfully removed the spaces, but the code I wrote made a wide space before the string. Here's my foreach loop
<ul class="list grid effect-6" id="grid">
<?php foreach ($ppmtenants as $ppmtenant): ?>
<li><span class="tenant"><a href="<?php echo $this->getURL() ?>catalogsearch/advanced/result/?tenants=<?php echo $ppmtenant['value'] ?>"><?php echo $ppmtenant['label'] ?></a><a href="<?php echo $this->getURL() ?>?___store=
<?php
$ppmtenantnospace = preg_replace('/\s+/','',$ppmtenant['label']);
echo strtolower($ppmtenantnospace);
?>"></a></span></li>
<?php endforeach; ?>
</ul>
And below is what I did to remove the spaces. I used preg_replace. Now, the spaces are gone, but it has a wide space before the string.
<?php
$ppmtenantnospace = preg_replace('/\s+/','',$ppmtenant['label']);
echo strtolower($ppmtenantnospace);
?>
Live example here: http://powerplantv2.jehzlau.net/brands. Screenshot here: http://i.imgur.com/wpQwxso.png
As you can see, if you hover on the images, there's an unwanted space after the ?. There should be no space so that my permalinks will work. If that space disappears, my problem will be solved. But I don't know how to make it disappear. I hope a php expert here can help me. :(