Jump to content

[SOLVED] How do i wrap <a> and </a> around an <img /> using regular expressions?


obay

Recommended Posts

for example, i want all

<img src="someImage" width="someValue" height="someValue" />

to become

<a>
<img src="someImage" width="someValue" height="someValue" />
</a>

i've tried:

preg_replace('/<img[^>]+>/', '<a> $1 <a>', '<img src="" width="" height="" >');

but it doesn't work.. LOL sorry im really new to this thing

 

any help?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.