par
Berzemus » 17 sept. 2009, 13:13
Je me demandais s'il existait une fonction qui ferait l'opération inverse comme la fonction nowrap en css?
Non, mais il y à ceci:
$nl=array("\n\r","\n","\r");
str_replace($nl,"",$subject);
Ensuite s'il existait une fonction comme nl2br() mais faisant l'opération inverse: <br> -> \r\n?
Il y en à environ 15 sur cette page :
http://us.php.net/manual/en/function.nl2br.php
Au hasard:
function br2nl($string)
{
return preg_replace('/\<br(\s*)?\/?\>/i', "\n", $string);
}
[quote="Dr@ke"]Je me demandais s'il existait une fonction qui ferait l'opération inverse comme la fonction [i]nowrap[/i] en css?[/quote]
Non, mais il y à ceci:
[php]
$nl=array("\n\r","\n","\r");
str_replace($nl,"",$subject);[/php]
[quote="Dr@ke"]Ensuite s'il existait une fonction comme nl2br() mais faisant l'opération inverse: <br> -> \r\n?[/quote]
Il y en à environ 15 sur cette page : http://us.php.net/manual/en/function.nl2br.php
Au hasard:
[php]function br2nl($string)
{
return preg_replace('/\<br(\s*)?\/?\>/i', "\n", $string);
}[/php]