php - Replace word when stand alone -


i have query:

select last_name lastname table 

and want change "as" keyword capital (for rest of script run properly), when alone.

when use script:

$toupper = str_replace(array("select","from","where","order by", "group by", "as"),                   array("select","from","where","order by", "group by","as"),$query); 

it change other strings have "as". becomes this:

select last_name lastname table 

how can replace stand alone keyword "as" "as"?

you can use exact code have.

since as statement has space before , after it, modify str_replace have space before , after as , as, so:

$toupper = str_replace(array("select","from","where","order by", "group by", " ",),array("select","from","where","order by", "group by"," "),$query); 

the result is:

select last_name lastname table

this way can keep code have virtually identical.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -