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

  • Home
  • SEARCH
  • 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 7086677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:34:46+00:00 2026-05-28T07:34:46+00:00

Supposing I have the following script <div id=something> <?php // execute a loop ?>

  • 0

Supposing I have the following script

<div id="something">
    <?php
        // execute a loop
    ?> 
</div>

<script>
    //use jquery to show "something" div block on and off <toggle> by a button click event, for example
</script>

My question is about whether or not the loop in the php tag code is executed each time the div is to be displayed. I think this is not a good way to handle this for possible performance issues, but I have been unable to find another way around to deal with this. Thank you for any advice and corrections.

  • 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-05-28T07:34:47+00:00Added an answer on May 28, 2026 at 7:34 am

    No the PHP will not execute in this case. PHP is a server side scripting language. When you nest some PHP in your HTML code, the PHP is executed on the server side, possibly producing some HTML. When the client gets the page, they will only ever see HTML code.

    On the web server:

    <div id="something">
        <?php
            echo "hello";
        ?> 
    </div>
    

    In the browser:

    <div id="something">
        hello
    </div>
    

    Now, JavaScript is a client side language, so you might ask if I put JavaScript code in the div, would it execute every time I show/hide it? The answer is also no. When you show/hide elements on the page with jQuery, they still exist on the page, only their styles have changed. If you were to add a script element to the page, this would indeed be executed once for each time you added it.

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

Sidebar

Related Questions

What's the object type returned by Datepicker? Supposing I have the following: $(#txtbox).datepicker({ onClose:
Supposing to have something like this: #include <map> int main(){ std::map<int,int> m; m[1] =
I have the following use case: I need to process a big number of
Supposing I have the following type from an external library: union foreign_t { struct
Supposing I have the following text: Lorem ipsum dolor sit amet, consectetur adipisicing elit,
I was wondering if someone can help me, I have the following script that
Supposing I have the following LambdaExpression: var itemParam = Expression.Parameter(typeof(Thing), thing); var someValue =
Supposing I have the following: module A class B # ... end # ...
I have tried to use the following regex expression to remove html whitespace and
Supposing I have the following public class Foo { private Map<Integer,SomeObject> myMap; public Foo()

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.