Splitting a string
| From: | Børge Holen | Date: | Tue, 14 Nov 2006 23:17:25 +0000 |
| Subject: | Splitting a string | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-244630@lists.php.net to get a copy of this message | ||
This numer has dynamic lenght, witch is the root of my problems.
$number = 123456789
should print as following:
var1: 12345 (and it is this lengt witch varies)
var2: 67
var3: 89.
I've been using substr with negative numbers to fetch the last two vars.
thereafter explode to get the first number.
Ok I understand the code and can use it, but it feels wrong.
Does anyone have any idea on suitable functions for such a task, both more
size (as in code) and speed effective. It is not a mission critical, but
moreover a opinion of what things should look like.
I've been looking into string/explode functions on php.net without getting
past my current code.
--
---
Børge
Kennel Arivene
http://www.arivene.net
---