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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:53:07+00:00 2026-06-02T05:53:07+00:00

Is there a principle that advises against doing things like: mysql_real_escape_string(trim(str_replace($var, black, <body text=’%body%’>)));

  • 0

Is there a principle that advises against doing things like:

mysql_real_escape_string(trim(str_replace($var, "black", "<body text='%body%'>")));

If something like that should be a no-no, then would this be acceptable?

$var = trim($var);
$var = str_replace($var, "black", "<body text='%body%'>");
$var = mysql_real_escape_string($var);

Or is that bad practice also, to call and perform on the same variable on a single like, like I did above? Would it be better to do:

$var1 = trim($var);
$var2 = str_replace($var1, "black", "<body text='%body%'>");
$var3 = mysql_real_escape_string($var2);

I’ve always wondered this!

  • 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-02T05:53:09+00:00Added an answer on June 2, 2026 at 5:53 am

    I think the normal practice is to “nest” the functions like the first example.

    There are a couple reasons, but mostly it shows that everything is happening to the same object in a specific order, with nothing going on in-between.

    That being said, if you don’t know exactly what you are going to be doing, you might want to start with the second example, so you can easily go back and add in functions.

    Basically, the first is preferred and more common (I think) in the end, the second is good for testing and development, and the third is just a waste of resources (granted it is small, but there’s no need).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any library that aids in implementing the design by contract principle in
I believe that readability and the KISS principle are the most important things in
There's some object-oriented engineering principle that states something along the lines of a class
I'm wondering if there's a specific programming principle (Demeter?) that supports the idea that
I read somewhere that there is a guiding principle to limit the number of
Are there any known design principles, best-practices and design patterns that one can follow
There's always skepticism from non-programmers when honest developers learn the techniques of black hat
There is nothing like the 43rd day of your life spent tracking down issues
The principle of sessions is to save data on server side that can be
I'm in a project that takes the Single Responsibility Principle pretty seriously. We have

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.