Count words of a body field using PHP views field I'm looking for a way to count the amount of words in my body fields, using Views PHP. I am totally new to PHP and this looks so easy, but I must be missing something.

So I have a View for Content, containing a body field (hide display, HTML trimmed) and a Global: PHP field.

I have this in my "Value Code"-field inside the Global: PHP field settings:

$count = print $row-&gt;body;
$result = str_word_count("$count");


And this in my Output:

&lt;?php echo $result ?&gt;


Seems I must be missing something, but I get no error, nor any result. Just nothing happens.
So, after a long research, I stumbled at this issue post. It seems that field data are not present in the result set of Views PHP, so instead of print $row-&gt;bodyI needed to use print $data-&gt;_field_data['nid']['entity']-&gt;body['nl'][0]['value'] to access the data.  This solved my problem.