Question:- What is "echo" in PHP?
Answer:- PHP echo output one or more string. It is a language construct not a function. So the use of parentheses is not required. But if you want to pass more than one parameter to echo, the use of parentheses is required.
Question:- What is "echo" Syntax in PHP?
Answer:- void echo ( string $arg1 [, string $... ] )
Question:- What is "print" in PHP?
Answer:- PHP print output a string. It is a language construct not a function. So the use of parentheses is not required with the argument list. Unlike echo, it always returns 1. Syntax: int print ( string $arg)
Question:- What is the difference between "echo" and "print" in PHP?
Answer:- Echo can output one or more string but print can only output one string and always returns 1. Echo is faster than print because it does not return any value.
Question:- How a variable is declared in PHP?
Answer:- A PHP variable is the name of the memory location that holds data. It is temporary storage. Syntax: $variableName=value;
Question:- What is the difference between $message and $$message?
Answer:- $message stores variable data while $$message is used to store variable of variables. $message stores fixed data whereas the data stored in $$message may be changed dynamically.
Question:- What are the ways to define a constant in PHP?
Answer:- PHP constants are name or identifier that cant be changed during execution of the script. PHP constants are defined in two ways: Using define() function Using const() function
Question:- What are magic constants in PHP?
Answer:- PHP magic constants are predefined constants, which change based on their use. They start with a double underscore (__) and end with a double underscore (__).
Question:- How many data types are there in PHP?
Answer:- PHP data types are used to hold different types of data or values. There are 8 primitive data types which are further categorized in 3 types: Scalar types Compound types Special types
Question:- How to do single and multi line comment in PHP?
Answer:- PHP single line comment is made in two ways: Using // (C++ style single line comment), Using # (Unix Shell style single line comment) PHP multi-line comment is made by enclosing all lines within.
Question:- What are the different loops in PHP?
Answer:- For, while, do-while and for each.
Question:- What is the use of count() function in PHP?
Answer:- The PHP count() function is used to count total elements in the array, or something an object.
Question:- What is the use of header() function in PHP?
Answer:- The header() function is used to send a raw HTTP header to a client. It must be called before sending the actual output. For example, you cant print any HTML element before using this function.
Question:- What does isset() function?
Answer:- The isset() function checks if the variable is defined and not null.
