explode.php : explode « Data Structure « PHP






explode.php

 
<?php
$summary = <<< summary
line 1
line 2
<a href="http://www.php.net">PHP 5</a>
summary;
$words = sizeof(explode(' ',strip_tags($summary)));
echo "Total words in summary: $words";
?>
  
  








Related examples in the same category

1.Breaking Strings into Arrays with explode()
2.Display year an individual was born
3.Using the explode() Function
4.Generating an ID with microtime()
5.explode( ) function converts a string into an array using a separator value
6.explode() function divides string into various elements, returning these elements in an array.
7.Using explode() with date()
8.Processing variable-length text fields
9.Reading and Writing Comma-Separated Data