Reputation: 13
why here str_replace not working
<?php
$str= '<div class=\"droppable\" ondrop=\"drop(event)\" ondragover=\"allowDrop(event)\"></div>';
echo str_replace('\"','"', $str);
i want to use str_replace with HTML tag.
Upvotes: 0
Views: 154
Reputation: 31749
As I get you want to remove the \
s to get proper HTML.
Better way should be -
stripslashes('<div class=\"droppable\" ondrop=\"drop(event)\" ondragover=\"allowDrop(event)\"></div>');
Output
<div class="droppable" ondrop="drop(event)" ondragover="allowDrop(event)"></div>
Upvotes: 1