jmanfffreak Posted December 8, 2011 Share Posted December 8, 2011 Hi, I have a simple block of code that I need to pull into strings and then store to a MySQL database label: '(AB56) SOME COMPANY', street: '123 SOME STREET', city: 'SOME CITY', state: 'CA', zip: '12345', country: 'United States', email: 'some.guy@somecompany.com', I need to pull everything after each colon ( into their own variable. Hopefully, I can give what I want to be the end result, and people can guide me on how to get there. $label = "AB56"; $company = "SOME COMPANY"; $street = "123 SOME STREET"; $city = "SOME CITY"; $state = "CA"; $zip = "12345"; $fname = "Some"; $lname = "Guy"; $email = "some.guy@somecompany.com"; Is something like this possible given the block of code? Any guidance would be most appreciative. Thanks a ton! Quote Link to comment https://forums.phpfreaks.com/topic/252783-i-believe-this-is-regex-stuff/ Share on other sites More sharing options...
requinix Posted December 8, 2011 Share Posted December 8, 2011 Where is this "code" coming from? Quote Link to comment https://forums.phpfreaks.com/topic/252783-i-believe-this-is-regex-stuff/#findComment-1295980 Share on other sites More sharing options...
jmanfffreak Posted December 8, 2011 Author Share Posted December 8, 2011 Just out of curiosity, why do you need to know? Quote Link to comment https://forums.phpfreaks.com/topic/252783-i-believe-this-is-regex-stuff/#findComment-1295984 Share on other sites More sharing options...
requinix Posted December 8, 2011 Share Posted December 8, 2011 It looks like JSON, and PHP can natively decode JSON... Quote Link to comment https://forums.phpfreaks.com/topic/252783-i-believe-this-is-regex-stuff/#findComment-1295996 Share on other sites More sharing options...
jmanfffreak Posted December 9, 2011 Author Share Posted December 9, 2011 It looks like JSON, and PHP can natively decode JSON... Aha! I did not know about this. I will look into it further. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/252783-i-believe-this-is-regex-stuff/#findComment-1296013 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.