I'm trying to figure out how to get a character count from a group of values in an array, so I can test it in an if statement.
Best if I give you an example of what I want to do:
//sample
$content = '<p>this is p 1</p><p>this is p 2</p><p>this is p 3</p><p>this is p 4</p><p>$test</p>';
$parts = explode('</p>',$content);
foreach ($parts as $key => $value) {
$test = count_chars($value[0] + $value[1] + $value[2]);
if ($test > 40) {
echo 'Yep, there are '.$test.' characters in the first three paragraphs<br />';
}
else {
echo 'Nope. There are '.$test.' characters in the first three paragraphs<br />';
}
}
I don't work with arrays much, so not sure how to do this. Right now $test just gives me 'array'.
And I know this is going to repeat the same string, this is not the final product, stripped out as many details as I could so we could focus on the situation I'm stuck on :)
