Makes an array of a string.
This function takes a string and a separator and returns an array where each element is a portion of the string separated from other portions by the separator.
<?php
$text = "192.168.0.1 gw\n192.168.0.2 fileserver\n192.168.0.3 dev";
$hosts = explode("\n", $text);
foreach ($hosts as $host) {
print "$host<br>";
}
?>
192.168.0.1 gw
192.168.0.2 fileserver
192.168.0.3 dev
A string contains a few lines of data that could be from a "hosts" file. The explode() function is used to get an array with one element for each host.