On Tue, Aug 12, 2003 at 01:58:21PM -0600, Micah Montoy wrote:
> I'm having a bit of difficulty getting a string to attach to itself from an
> array. Here is the bit of code I'm working on.
>
A bunch of simplifications, efficiency tweaks on this approach...
> $wresult = "";
$wresult = '';
>
> foreach ($search_string as $word_result){
> $wresult = $wresult & " " & $word_result;
$wresult = $wresult . ' ' . $word_result;
OR you can do...
$wresult .= $word_result;
> }
>
> echo ("$wresult");
echo $wresult;
BUT, the far far far better way to do this just takes one line:
echo implode(' ', $search_string);
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php