Create an array with the words from the string in PHP

Description

The following code shows how to create an array with the words from the string.

Example



<?php
    print_r(str_word_count("Hello world!",1));
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Data Types »




Array
Array Associative
Array Util
ArrayObject
Data Types
Date
Date Format
DateTime
Number
String
String Escape
String Filter
String HTML
String Type
Timezone