$num_paras = substr_count($content, ''); switch ($num_paras) { case 1: $image = 'one.jpg'; break; case 2: $image = 'two.jpg'; break; case 3: $image = 'three.jpg'; break; default: $image = ''; break; }
2798 users tagging and storing useful source code snippets
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
$num_paras = substr_count($content, ''); switch ($num_paras) { case 1: $image = 'one.jpg'; break; case 2: $image = 'two.jpg'; break; case 3: $image = 'three.jpg'; break; default: $image = ''; break; }
You need to create an account or log in to post comments to this site.
of course depending on image naming..
where 0.gif is a 1x1 pixel clear gif.
or if coming from a database (i.e. data filtered through strip tags)