0

I have an variable $query which holds for example 5.6" display or 5.6 " display is there anyway to change it to 5.6 inch display for both of the previous given examples? I tried using preg_split but I had no luck so far.

vincent kleine
  • 724
  • 1
  • 6
  • 22

1 Answers1

2

You can use

str_replace('"', ' inch', $query);

To replace any quotation marks with " inch"

If you put in 5.6" it will output

5.6 inch

EDIT: If you want to remove double spaces of which would happen if you input

5.6 "

Then you should run this code after

preg_replace('/\s/', ' ', $query);
Enayet Hussain
  • 908
  • 4
  • 17
  • 33