Log in

View Full Version : Multiple



bluewalrus
11-11-2008, 05:31 PM
I got this code on another site but I don't know how many occurrences of the said id there will be is there a way to make the id like x or an increasing #.
<?php
$string = "upload file contents ID=#1THIS IS WHAT FILE CONTAINS ID=#2 SECOND FILE CONTENTS";
$find = "ID=";
$first = strtok($string, $find); // "upload file contents"
$second = strtok($find); // "#1THIS IS WHAT FILE CONTAINS "
$third = strtok($find); // "#2SECOND FILE CONTENTS"
$fourth = strtok($find); // false
?>

I will not know how many ID's there will be as they are being created else where. So the first second third fourth variable won't work because there could be over 100. The info of each will be within the ID='s though always.