Thursday, 15 March 2012

Truncate php variable before symbol -



Truncate php variable before symbol -

can help me quick solution problem?

i have string returned api, string comes this:

$year = "181?make=2008"

so using substr($year, 0,3); first 3 digits out. i.e. 181 problem is, of strings coming 2 digits before ? $year = "54?make=2008"

so, if dont know how many digits coming before ?, know end ? there way can extract info before ? , turn new variable...

thank in advance!

$year = strstr("181?make=2008","?");

php truncate substr

No comments:

Post a Comment