PHP Question Answerggupv
PHP Question Answerggupv
There are two main rules that you have to follow when naming a variable in PHP.
They are as follows:
Naming a variable in PHP is simple, but some rules must be followed. Variable names
must begin with a letter or an underscore, followed by any number of letters, numbers,
or underscores. Additionally, PHP variable names are case sensitive, meaning that a
variable named 'myVariable' is distinct from 'my variable.' Furthermore, variable names
cannot use PHP keywords such as 'int,' 'float,' or 'array.'
• Both $message and $$message are variables in PHP and the difference lies
in the name. While $message is a variable with a fixed name, $$message is a
variable with a name that is actually stored in $message.
• Consider the following example:
1If $message consists of ‘var’, then $$message is nothing but ‘$var’.
The primary difference between "echo" and "print" in PHP is that "echo" is a language
construct, and "print" is a function. "echo" also has slightly better performance and is
more succinct, making it preferable in situations where performance and size matter.
Yes, HTML and PHP interaction is at the core of what makes PHP’s functionality.
PHP scripts have the ability to generate HTML mode and move around information
very easily.
PHP is designed to interact with HTML. It’s possible to embed PHP scripts in an HTML
page without a problem and transfer information from HTML to PHP.
For example, user-defined functions in PHP can be defined in uppercase but later
referred to in lowercase, and it would still function normally.
• CodeIgniter
• CakePHP
• Symfony
• Zend Framework
• Yii 2
10. What are some of the key features of PHP?
• It is completely open-source.
• It is compatible with many databases, like MySQL, SQLite, etc.
• It is platform-independent, that is, it can be run on any operating system
like Linux, Unix, Windows, etc.
• It is object-oriented, that is it supports object oriented functionalities
like encapsulation, inheritance, abstraction, and polymorphism.
“===” operator is used to do a strict check that also checks for datatypes along with
values
13. List the main types of errors in PHP and explain their
differences.
• Notices. These are non-critical errors that can occur during the script
execution. These are not visible to users. Accessing an undefined variable is
an example of a 'Notice'.
• Warnings. These are more critical than Notices, but just like them, Warnings
don't interrupt the script execution. However, these are visible to the user by
default. Example: include() a file that doesn't exist.
• Fatal. This is the most critical error type which, when occurs, immediately
terminates the script execution. Accessing a property of a non-existent object
or require() a non-existent file is an example of this error type
ASP.NET PHP
A programming framework A scripting language
Compiled and executed Interpreted mode of execution
Designed for use on Windows Platform independent