Jump to content

Recommended Posts

I have this long code put in a string (i used file_get_contents to get it from another page):

 

223869,1550,30492847 432402,76,1409849 369422,75,1245567 501886,79,1947581 436335,79,1910533 359856,75,1250659 413704,55,177302 396838,73,1078967 690109,67,551412 6972,99,15319606 242629,81,2315289 785464,64,435123 287781,68,611815 349404,61,318931 786534,52,132517 1139395,60,274476 320949,48,86768 182000,61,305119 264238,56,199676 330524,56,188663 205315,50,102585 232534,53,147552 289503,56,185844 131858,57,205193 180331,49,91820 -1,-1 -1,-1 -1,-1 422632,500

 

And i need to put each of the parts that parts are divided by commas (1st: 223869, 2nd: 1550 etc.) in an array variable (for example, array[0] is the first part, array[1] is the second one).

 

How do i do this? Im only a PHP beginner at the moment  ???

Link to comment
https://forums.phpfreaks.com/topic/151523-adding-parts-of-a-string-to-an-array/
Share on other sites

Is there a way to make explode divide parts by commas OR empty spaces? In the long code there are parts like:

 

223869,1550,30492847 432402

 

And after 30492847 is a space not a comma, but those 2 numbers need to be divided too.

 

I was thinking that before i use explode on the $contents array, i replace the spaces with a comma.

Is there a function in PHP that changes a character to something else?

Weird, it still doesn't remove the spaces. Anyway heres an example from where im taking the code:

 

http://hiscore.runescape.com/index_lite.ws?player=Destructo14

 

I checked it source and it looks like after a part of the code ENTER is pressed and it goes to a new line (it only shows like that in the source so he didn't use <br> or <p></p>

 

What should i do to remove the places where ENTER was pressed/spaces (?)

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.