Posted by Sean Barton on 02/08/06 00:47
easy enough. you can use a string tokeniser and use the ( as the
delimeter. it depends on how random the string will be to how you will
harvest the number.
for example:
$string = strtok($longstring,'(');
will give you:
20) and pears
then from then you can go...
$num1 = strtok($string,')');
$num1 would be 20.
its basic but would work.now its up to you how you work it you can run
more than one tokeniser at once so tokenise at the ' ' to get each word
or look into a function called explode()
i suppose to say that if the strings will be pretty regular then you
can use this and if not you would have to make it a little more dynamic
hope this helps
Sean Barton
Navigation:
[Reply to this message]
|