i'm trying to strip IPs
like...
$ip = "123.456.78.9";
and i want to break it up into
123
456
78
9
so i want to break it up based on the period
i figure i'd have to use strchr, but it only looks for the first instance of "."
any help???
thanks
--pb
help striping a string
Moderator: General Moderators
-
penguinboy
- Forum Contributor
- Posts: 171
- Joined: Thu Nov 07, 2002 11:25 am
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
You can use explode() to do this:
will explode out the parts into separate array elements.
Mac
Code: Select all
$ip = "123.456.78.9";
$ip_array = explode('.', $ip);Mac
-
penguinboy
- Forum Contributor
- Posts: 171
- Joined: Thu Nov 07, 2002 11:25 am