Question about an array
| From: | Vernon | Date: | Sat, 03 Jan 2004 22:11:48 +0000 |
| Subject: | Question about an array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-173695@lists.php.net to get a copy of this message | ||
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