RE: [PHP] Split problems...
| From: | Matt Williams | Date: | Thu, 27 Jul 2000 11:36:23 +0000 |
| Subject: | RE: [PHP] Split problems... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-8529@lists.php.net to get a copy of this message | ||
Hi Martin
This works
$addr="127.0.0.1";
$ip_list = split("\.", $addr);
$i=0;
for($i=0; $i< count($ip_list); $i++) {
echo $ip_list[$i]."<br>";
}
M@
> -----Original Message-----
> From: Martin Thoma [mailto:martin@radiok2r.de]
> Sent: Thursday, July 27, 2000 12:11
> To: php-general@lists.php.net
> Subject: [PHP] Split problems...
>
>
> Split problems...
>
> I want tp split an Ip-Adresse (like 127.0.0.1) into pieces (127, 0, 0,
> 1)
>
> I tried:
>
> $ip_list = split(".", "127.0.0.1");
> print "Items:".count($ip_list)."<BR>";
>
> # First problem: Delivers Items: 10 (should be 4)
>
> for($i=0; $i<4; $i++)
> { $a = $ip_list[$i];
> echo "$i: $a<BR>";
>
> # Second Problem: $a is always mpty
> }
>
> Any ideas ?
>
> Regards
>
> Martin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>