|
Posted by -Lost on 06/29/06 20:33
I hate to beat a dead horse (if it was in fact), but what I meant earlier was that
creating a huge array may not have been your best choice. As you will always have to
compare your string against an array before outputting.
Whereby, I meant something along these lines:
<?php
$string = 'one two three four five six seven eight nine ten';
$string_into_pictures = explode(' ', $string);
foreach($string_into_pictures as $s2p)
{
$s2ps[] = str_split($s2p);
}
for($i = 0; $i < count($s2ps); $i++)
{
for($j = 0; $j < count($s2ps[$i]); $j++)
{
print $s2ps[$i][$j] . '.jpg<br />' . "\n";
//print '<img src="' . $s2ps[$i][$j] . '.jpg" alt="' . $s2ps[$i][$j] . '" />' . "\n";
}
print 'empty.jpg<br />' . "\n";
//print '<img src="empty.jpg" alt="space" />' . "\n";
}
?>
When you said you cannot explode a space it made me think "yes you can, sorta". Granted,
this may not be the best approach nor even fastest. I have found though that arrays and
regexps just for the sake of them does not mean better; faster; cleaner or anything for
that matter. Not saying they are bad though, understand the difference. Anyway... hope
this helps a bit.
-Lost
P.S. Oh yeah... I used the first prints as debug basically. Comment them and uncomment
the second to get your lovely images.
Navigation:
[Reply to this message]
|