-1
<input type="text" name="name" value="">

I am trying to remove the value="" from the string using preg_replace can anyone help I am not clued up with regex at all

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
  • ... _can anyone help I am not clued up with regex at all_ ➜ ___[Learning Regular Expressions](https://stackoverflow.com/q/4736/5698098)___ – Ivo Mori Jun 18 '20 at 04:27

1 Answers1

1

You don't need preg_replace if it's only value="". Use str_replace which is faster than using regex.

$string = '<input type="text" name="name" value="">';

print(str_replace('value=""','',$string)); //<input type="text" name="name" >
Jsowa
  • 9,104
  • 5
  • 56
  • 60