If you're going to build your array that way, then you need to loop through
$sometext[0], not $sometext.  You're creating an array in the first element
of the $sometext array, so $sometext element zero is an array containing
your exploded words.

Instead, try:

$sometext = explode(" ", "your long string");

--
Matt Grimm
Web Developer
The Health TV Channel, Inc.
(a non - profit organization)
3820 Lake Otis Parkway
Anchorage, AK 99508
907.770.6200 ext. 686
907.336.6205 (fax)
E-mail: [EMAIL PROTECTED]
Web: www.healthtvchannel.org

"Vernon" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I want to create an array with some text. Let's say the following:
>
> $sometext = array(explode(" ", "Objective: Position as a Machine Attendant
> and or Operator Summary - Over 16 years experience in packaging and
> maintenance of various operating machinery. - 13 years experience in
cutting
> steel and operating a steel press. - Part time experience in packaging and
> shipping bread for a bakery."));
>
> I can easily return that text using:
>
> print_r($sometext);
>
> However I want loop through that text for to bold certain words in the
> array. In any event I've tried using the following but it only returns
> "sometext at[0] is: [Array]" which is not want I want, I want it to show
me
> each word in the array through the loop. Any ideas what I am doing wrong?
>
> $arrayLength = count($sometext);
>
> for ($i = 0; $i < $arrayLength; $i++){
>    echo "sometext at[" . $i . "] is: [" .$sometext[$i] . "]<br>\n";
> }
>
> Thanks

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to