G
G
grechnik2282016-02-18 17:38:38
PHP
grechnik228, 2016-02-18 17:38:38

Php - How to remove \r\n?

<?php
$rs =  "https://en.search.wordpress.com/?q=tim+cook&f=json";
    $chp = curl_init($rs);
    curl_setopt($chp, CURLOPT_HEADER, 0);
    curl_setopt($chp, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($chp, CURLOPT_SSL_VERIFYPEER,0);
    $resultp=curl_exec($chp);
    curl_close($chp);

    $decode = json_decode($resultp, TRUE);
    foreach($decode as $res) {

$scontent = $res['content'];
$scontent = str_replace('\r\n', '  ', $scontent);
echo "".$scontent."";
?>

https://en.search.wordpress.com/?q=Tim+Cook&f=json
I can't get rid of \r\n !
help me please

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
leshaidol, 2018-01-14
@leshaidol

$scontent = str_replace(array("\r","\n"),"",$scontent);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question