Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8885331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:17:02+00:00 2026-06-14T21:17:02+00:00

I am attempting to use htmlspecialchars function to sanitize URLs. Below is the code:

  • 0

I am attempting to use “htmlspecialchars” function to sanitize URLs. Below is the code:

$new = htmlspecialchars("<a href='test'>Test</a>", ENT_QUOTES);
echo $new;

The anticipated output should be:

&lt;a href=&#039;test&#039;&gt;Test&lt;/a&gt;

However what I get is:

<a href='test'>Test</a>

It is not actually stripping the special characters at all. Am I doing something incorrectly? The above example is a copy and paste directly from php.net.

I am using PHP Version 5.4.8.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T21:17:03+00:00Added an answer on June 14, 2026 at 9:17 pm

    When I run that, the output I get is:

    &lt;a href=&#039;test&#039;&gt;Test&lt;/a&gt;
    

    Either:

    • Your PHP interpretor is broken
    • You are looking at the rendered HTML and not the HTML source
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am attempting to use the MediaStore.ACTION_VIDEO_CAPTURE in my app, see code below. However,
I am attempting to use the following code to search a database using words
I'm attempting to use jsoup to sanitize the the html posted from a wysiwyg
I am attempting to use the function DBMS_AQ.DEQUEUE_ARRAY in Oracle 10.2.0.4.0. to browse the
Hi I'm attempting to use the ASPFPDF class to output an image on a
I'm attempting to use document.location(.href) on the onLoad event to redirect from one page
I'm attempting to use the new Storyboard feature, however I am confused about Storyboard
I'm attempting to use MIB files in PySNMP. The code is fairly straightforward. Nothing
I'm attempting to use the code from http://www.codeproject.com/Articles/20165/CheckBox-Header-Column-For-DataGridView in order to add a CheckBox
While attempting to use the CopyFile() function I have encountered a strange error. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.