Jump to content
Sign in to follow this  
Adeleke

PHP question

Recommended Posts

Was there a printing issue with this question? This HTML very shaky. It seems like a trick question.

Does the validity of the HTML matter in your question?

 

Share this post


Link to post
Share on other sites

This looks like a homework question, we don't just do homework for people.

It seems like they're asking you to design a database table and write the PHP code that will  put the form data into the database. I would hope that you have some notes from your school describing how to do those things, but if not here are the relevant tutorial pages:

Share this post


Link to post
Share on other sites

Hi,

      I am completely a new to PHP. I am just in beginner level. So when i was going through the concept of Keywords global,local and static. there was an example specified to make us understand for static key word. "sometimes we want a local variable NOT to be deleted. We need it for a further job" which means the value when defined as static will no change right! below is the example i have seen .

Code:

<?php
function myTest() {
    static $x = 0;
    echo $x;
    $x++;
}

myTest();
myTest();
myTest();
?>

Result: 

0

1

2

my question is how is x getting incremented if it is defined as static. can some one explain me. again if i am wrong please correct me as i really dont know any in PHP. I am beginer.

 

Thank you!

Rekha

Share this post


Link to post
Share on other sites

which means the value when defined as static will no change right!

No, that's not what it means.  It means that the variable persists its value even across different function executions.  It means that each time that function runs, the variable has the value from the last time it ran.  If you don't want a value to ever change then use a constant.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...