Jump to content

PHP question


Adeleke

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?

 

Link to comment
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:

Link to comment
Share on other sites

  • 3 weeks later...

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

Link to comment
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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...