Jump to content

Need help on the explode function


victorianrider

Recommended Posts

Ok so what I have is a list of 32,000 IDs in a separate file called 32kIDs.txt and it has a list of roughly 32,000 user IDs for facebook which look like 100000233850312;1521225383;100000282767638;1252335882;1804268242

 

They're all separated by a semi-colon. What I need this script to do is echo each and every ID on screen, echoing each ID on a new line. I have been using the explode function but having trouble with it since I'm very new to PHP and don't have much experience yet.

 

Here is my current code:

 

<?PHP

$iFile = "32kIDs.txt";

$login = file($iFile, FILE_SKIP_EMPTY_LINES);

if(!is_file($iFile)) echo "The 32k add list couldn't be found...".sleep(999999);

foreach($login as $line_num => $line)

{

$login = explode(" ", htmlspecialchars(str_replace(";"," ",$line)));

echo $login[0]."\n";

}

sleep(20);

?>

 

So I bet there are going to be things in there that I don't even need and thing's I'm missing, if anyone can help it would be much appreciated. And I'd like to keep the code short, I could just put in:

echo $login[0]."\n";

echo $login[1]."\n";

echo $login[2]."\n";

echo $login[3]."\n";

 

all the way up to echo $login[32246]."\n"; but yeah I don't like the thought of a 32k+ line script.

 

Anyways...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.