Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

php: why   is not stripped

Tags:

html

php

Why   is not stripped in strip_tags()? Other than str_replace() any other possibilities?

like image 201
A.C.Balaji Avatar asked Dec 10 '10 14:12

A.C.Balaji


People also ask

Why would we use PHP?

Why to use PHP? PHP can actually do anything related to server-side scripting or more popularly known as the backend of a website. For example, PHP can receive data from forms, generate dynamic page content, can work with databases, create sessions, send and receive cookies, send emails etc.

Why PHP is the best programming language?

It is an open-source language. It is an easy-to-learn language, so PHP is the language of choice if you have less time on your hands. It is highly compatible, as it works with multiple programming languages such as HTML, Javascript and supports various database languages like MySQL, PostgreSQL, Oracle, and so on.


2 Answers

Well, it's not a tag :)

Also, yeah, html_entity_decode is the way to go.

like image 83
Spiny Norman Avatar answered Sep 24 '22 15:09

Spiny Norman


Unlike HTML tags, entities (such as < or  ) represent actual characters.
If you strip all entities from a piece of HTML, you'll ned up stripping all < characters, as well as any other characters that were included as entities.

You need to decode the entities into the characters that they represent, using the html_entity_decode function.

like image 21
SLaks Avatar answered Sep 24 '22 15:09

SLaks