![]() |
Quick php question
I know there's an easy way of doing this, but I'm having a brain freeze.
I want to extract the domain name from this array value a:1:{s:10:"formfield1";s:17:"www.domain.com";} Anybody know how? |
Without or without www.?
Without loading it as JSON shit or whatever that format is... explode is your friend. |
In my opinion this isn't even correct JSON.
Php has some JSON-functions, these will be the easiest way. |
This is fucked with by wordpress I am assuming. It has it's own API to pull it back out.
But if it all is in the same format.. just explode it and move on |
Code:
|
Quote:
So I guess you could just unserialize() it and then extract $foo['formfield'], which should yield 'www.domain.com'... [edit] After actually checking if it would work, I noticed your original isn't formatted properly... the second part claims it's going to contain a string of 17 characters when it's only a 14 character one... so this exact example won't work, but the original of 'www.domain.com' would probably work just fine :P |
Quote:
|
Above is wrong. Here:
Code:
$sString = 'a:1:{s:10:"formfield1";s:17:"www.domain.com";}'; |
All times are GMT -7. The time now is 04:56 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc