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 8876621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:15:24+00:00 2026-06-14T19:15:24+00:00

The server is running with PHP 5.2.17 , and I am trying to run

  • 0

The server is running with PHP 5.2.17, and I am trying to run get_html_translation_table() with three arguments. Here is how I invoke the function:

$text = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES, "UTF-8");

I am getting a warning message saying

get_html_translation_table expects at most 2 parameters, 3 given
(filename and line number).

Per PHP Documentation, the third argument is supported after PHP 5.3.4, but adding the third argument is the only way I can think of to encode the array returned in “UTF-8”. (It works despite the ugly warning message.)

I need get_html_translation_table() to create a function that encode all html special characters and spaces, and the following function just won’t work without the third argument.

/**
 * Trying to encoding all html special characters, including nl2br()
 * @param string  $original
 * @return string
 */
function ecode_html_sp_chars($original) {
    $table = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES, "UTF-8");
    $table[' '] = ' ';
    $encoded = strtr($original, $table);
    return nl2br($encoded);
}
  • 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-14T19:15:26+00:00Added an answer on June 14, 2026 at 7:15 pm

    Two options: change your php version or use the htmlentities function. In htmlentities the encoding parameter was added in 4.1.

    Example:

    function ecode_html_sp_chars($original) {
        $encoded = htmlentities($original, ENT_QUOTES, "UTF-8");
        $encoded = str_replace(' ', ' ', $encoded);
        return nl2br($encoded);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm setting up a new Ubuntu server running nginx, and I'm trying to run
Im running ubuntu server, and im trying to run a script every hour. What
I'm running PHP 5.2.3 on Windows 2000 Server with IIS 5. I'm trying to
I am trying to run a Python program using PHP. Here's the code $command
We have a server running PHP 4.3.9 with safe_mode ON and safe_mode_exec_dir setted to
My server is running php and I want it to be able to send
We are running PHP on a Windows server (a source of many problems indeed,
I've got a web server running IIS7 and I just updated to PHP 5.3.
i am setting up cakephp app on a windows server running iis7. PHP is
How to send messages from php to node.js? I have a linux server running

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.