Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php string convert to html

Tags:

php

character

I have a string <div id="myid">...</div>

How would I change this into <div id="myid">...</div>

I have tried a few things but no luck any help?

Update

function get_page(){
  $file = 'file.php';
  $str = file_get_contents($file);
  $str = html_entity_decode($str);
  return $str;
}
$output = get_page();
echo $output;//don't work

FIX

function get_page(){
      $file = 'file.php';
      $str = file_get_contents($file);
      return $str;
    }
    $output = get_page();
    echo html_entity_decode($output);//works
like image 979
Val Avatar asked Nov 29 '22 17:11

Val


1 Answers

The function for that is htmlspecialchars_decode().

Note that for the function to decode quotes, you need to specify the $quote_style parameter.

like image 115
Pekka Avatar answered Dec 09 '22 11:12

Pekka