Re: looping through text with array_key_exists function



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.


.



Relevant Pages

  • Help in French|Spanish|German translation.
    ... I am also an author of User-defined string functions. ... WORDTRANEX (cSearched, cArExpressionSought | cExpressionSough, ... each string of the array is searched ... If the parameter nArStartOccurrence is -1 or omitted, the replacement starts ...
    (microsoft.public.fox.helpwanted)
  • Re: passing a string to a dll
    ... Joe, I really appreciate you taking the time to demonstrate this. ... sure how I would implement indexing it for random alphanumeric codes. ... I might handle the array. ... I actually have been wondering if I could use a second string ...
    (microsoft.public.vc.mfc)
  • Re: passing a string to a dll
    ... I might handle the array. ... I actually have been wondering if I could use a second string ... look at insertion cost, organization cost, and search cost. ...
    (microsoft.public.vc.mfc)
  • RE: Structure conversion from C++ to VB-2008?
    ... One of the most important structures is AmiVar structure. ... point number, the array of floating point numbers, a string or IDispatch ... Dim 13012679 as Integer ...
    (microsoft.public.dotnet.languages.vb)
  • Structure conversion from C++ to VB-2008?
    ... One of the most important structures is AmiVar structure. ... point number, the array of floating point numbers, a string or IDispatch ... Dim 13012679 as Integer ...
    (microsoft.public.dotnet.languages.vb)