troubleshooting Question

php check if variable contains a string

Avatar of seopti
seopti asked on
5 Comments1 Solution597 ViewsLast Modified:
The code below works fine. I would like to add an additional if statement so
if(sizeof($listing['images']) > 0)

AND if

$listing['images']   contains the string   "ecarlist"

the following image should not be loaded:
				if(sizeof($listing['images']) > 0) {
					echo '';
						echo '<div><a rel="'.$listing['id'].'" title="'.$listing['title'].'" href="'.$listing['images'][0]['org'].'"><img style="vertical-align: top;" src="'.$listing['images'][0]['220'].'" /></a></div>';
					$photo_count = sizeof($listing['images']);
					for($x = 1; $x < $photo_count; $x++) {
						if($photo_count > 1) {
						echo '<div style="float: left; margin-left: 12px;margin-top:3px;"><a rel="'.$listing['id'].'" title="'.$listing['title'].'" href="'.$listing['images'][$x]['org'].'" target="_blank"><span class="pictureFrame"><span class="image"><img src="'.$listing['images'][$x]['90'].'" title="'.$listing['title'].'" /></span><span class="overlay"></span></span></a></div>';
						echo ($x/2 == 0 && $x != $photo_count) ? '<div class="clear></div>' : '';					}
					echo '';


Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros