[thelist] PHP coding help
R.Livsey
R.Livsey at cache-22.co.uk
Fri Sep 7 05:57:57 CDT 2001
Both steps can be combined by using substr() and strlen()
$len = strlen($xml);
$id = substr($xml, $len-20, 5);
basically, find the length of the xml string, minus 20 is the starting
point.
You want the part of the string from that point, upto 5 onwards.
or combined :
$id = substr($xml, strlen($xml)-20, 5);
$id now contains 00006 from the example file you give.
Hope that helps.
R.Livsey
------------------------------------------
All those who believe in psychokinesis raise my hand.
------------------------------------------
Lead Programmer for the Tickle Group
Freelance work always welcome
[ PHP | Perl | mySQL | Java ]
w : cache-22.co.uk
e : R.Livsey at cache-22.co.uk
m : +447764 685 701
i : 37530949
> 3) Search file for last 20 characters
> - 00006</id></id_list>
> 4) Select first 5 characters (of last 20 from file) & convert
> to integer
> - 00006
>
> I've worked out how to do some of these, but I'm having
> problems with steps 3 & 4.
>
> Any suggestions?
>
> Thanks,
> dante
More information about the thelist
mailing list