Variables

51
2692 reads

February 11, 2013

Lifetime


We know a variable declared within a block will lose its value when the block is left.
Thus the lifetime of a variable is confirmed to its scope.

29
2596 reads

February 11, 2013

Scope


Scope refers to the visibility of variables. In other words, which parts of your program can see or use it. Normally, every variable has a global scope.

55
2604 reads

February 11, 2013

Variables


Variables are made to hold varying values.These can be reassigned as & when reqd.

41
1427 reads

February 8, 2013

scope of parameters


this example shows that sending a function a parameter does not affect its value at the rest of the code outside the function

289
3226 reads

February 8, 2013

scopes of variables


this example shows the concept of scope with a clear example to 3 types of scopes
1- local scope
2- global scope
3- static scope

144
1402 reads

February 8, 2013

defining variables and changing their types


this examples shows how to create and give variables values and the right PHP statement components
and it also shows how the types in php can be changed easily without casting

206
35322 reads

February 8, 2013

Instance variable


A class or object can have it's own variables. In Java, these are called instance variables.

126
2398 reads

February 8, 2013

Local Variable


Local variables can only be referenced and used locally in the method in which they are declared.

1. Local variable lifetime is from method entry to method return.

239
2583 reads

February 8, 2013

Usage of final variable.


A final variable can only be initialized once, either via an initializer or an assignment statement. It does not need to be initialized at the point of declaration

44
1706 reads

February 8, 2013

Passing Variables to Functions


This example demonstrates passing arguments by reference and by value to functions.

Pass By Reference :