I use PHP 5.2
When I omit the special characters ">" and "<" then this code works :
<?php
$old = 'stroke-dasharray="-1"';
$new = 'stroke-dasharray="none"';
$ligne = '<path stroke-opacity="1" stroke-miterlimit="1" stroke-linejoin="round" stroke-linecap="round" stroke-dasharray="-1" stroke-width="1" fill-opacity="0" style="fill-opacity: 0; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; stroke-miterlimit: 1; stroke-opacity: 1; cursor: move;" d="M179.5,80.5L317.5,80.5" stroke="#808080" fill="none"/>';
$ligne = htmlentities($ligne);
$chaine = str_replace($old, $new, $ligne);
$chaine = html_entity_decode($chaine);
echo "remplacement donne : ".$chaine;
?>
So how to code correctly the str_replace ?