ANSWER: A pointer in a programming language is a variable that holds the address of another type. For instance, an "int pointer" is the address of the location in which an integer is stored. Pointers are more often used for dynamically allocated types, and much more often for complex types. A pointer (a 32-bit memory location) to store the address of a 32-bit integer is wasteful, but the address of a hashtable is useful.
Pointers do not officially (as a native type) show up in high level languages like C# and Java. In the days that C and C++ were popular, pointers were an essential part of programming.
Q.2 What is a Function Pointer?
ANSWER:Function Pointers are pointers, i.e. variables, which point to the address of a function. You must keep in mind, that a running program gets a certain space in the main-memory. Both, the executable compiled program code and the used variables, are put inside this memory. Thus a function in the program code is, like e.g. a character field, nothing else than an address. It is only important how you, or better your compiler/processor, interpret the memory a pointer points to.
Q.3 How do I find out the number of parameters passed into function?
ANSWER:
- func_num_args() function returns the number of parameters passed in.
Q.4 What’s the output of the ucwords function in this example?
ANSWER:
$formatted = ucwords(" PHPUSE IS COLLECTION OF INTERVIEW QUESTIONS");
print $formatted;
ucwords() makes every first letter of every word capital, but it does not lower-case anything else. To avoid this, and get a properly formatted string, it’s worth using strtolower() first.