Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: parsing through strings (php)  (Read 741 times)

0 Members and 1 Guest are viewing this topic.
parsing through strings (php)
« on: October 20, 2007, 06:39:47 pm »
  • Doesn't afraid of anything
  • *
  • Reputation: +42/-0
  • Offline Offline
  • Gender: Male
  • Posts: 7002
I'm helping out someone with a cybernations database and he wants to be able to take the mynation page, copy and paste it into the database (which puts it into a string variable) , put _ wherever there are spaces and then parse through the string for certain data and put that data into double varaibles.  I don't know a damn thing about php, How would I do this?
Logged



i love big weenies and i cannot lie

mit

Re: parsing through strings (php)
« Reply #1 on: October 21, 2007, 03:21:51 pm »
  • QBASIC programmer since age 4. Take that, world.
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 1079
Explain "Parse through" - you can split it into an array using explode(), or you can go through it letter by letter... Or if you're up for it you can try using preg_replace(), depends entirely on what you're trying to do. Probably explode() will be best.

To change every space into an underscore, do:
$str= str_replace(" ", "_", $str);
Logged
Programmer / Spriter / Level designer / Game Director / Web Designer / Music Sequencer for
Random Highscore table:

Play the Kousou Arcade today!
  • Kousou Games
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.286 seconds with 41 queries.