How to pass a variable from php to a modal?

(PHP) What is the difference between a static variable and a "pass by reference" variable?

  • I understand that a static variable will maintain its' current value within its' scope (function), and that when accessed again under whatever circumstance will have maintained its' last initialized value. I understand that a "pass by reference" value will actually permanently change the initial value of the variable that was passed by reference, whatever the scope may be. So, are these not the same in functionality?

  • Answer:

    A reference and static variables are very different. It is true that if a variable is not declared static within a function, it is released when control returns from the funtion. A static variable will retain its value every time that function is called. So if you were to change a static variable's value to 2 within a function, during the next function call, the variable would have a value of two. But a static variable's scope is local to that function. It cannot be accessed outside of that function. A reference variable on the other hand, is very different. It is a variable that "references" another variable by use of memory addresses. It is essentially another name for that variable that can be passed to a function to change the variable it is referencing. So with reference variables you have more freedom in a sense. You can use that reference variable for any function you declare and modify the variable it is referencing

Ian at Yahoo! Answers Visit the source

Was this solution helpful to you?

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.