php.ini
PHP Questions and Answers
PHP is an important part of the web world, and every web developer should have the basic knowledge in PHP. Common PHP questions, which should help you become a best PHP developer.
Which is the configuration file of Apache?
httpd.conf
What is magic methods in php?
The function names __construct, __destruct, __call, __callStatic, __get, __set, __isset, __unset, __sleep, __wakeup, __toString, __invoke, __set_state and __clone are magical in PHP classes. You cannot have functions with these names in any of your classes unless you want the magic functionality associated with them.
What is stored procedure?
A stored procedure is a set of SQL commands that has been compiled and stored on the database server.
Once the stored procedure has been “stored”, client applications can execute the stored procedure over and over again without sending it to the database server again and without compiling it again.
Stored procedures improve performance by reducing network traffic and CPU load.
Stored procedures are essentially functions that you can create in the database and reuse. What’s neat about them from a usability standpoint is that they can take input parameters and then return a result.
What is the difference between Drop,Delete and Truncate?
The DELETE command is used to remove rows from a table. A WHERE clause can be used to only remove some rows. If no WHERE condition is specified, all rows will be removed. After performing a DELETE operation you need to
COMMIT or ROLLBACK the transaction to make the change permanent or to undo it.
TRUNCATE removes all rows from a table. The operation cannot be rolled back. As such, TRUCATE is faster and doesn’t use as much undo space as a DELETE.
The DROP command removes a table from the database. All the tables’ rows, indexes and privileges will also be removed. The operation cannot be rolled back.
What is PHP ini_set() ?
Sets the value of the given configuration option. The configuration option will keep this new value during the script’s execution, and will be restored at the script’s ending.
<?php
echo ini_get(‘display_errors’);
if (!ini_get(‘display_errors’)) {
ini_set(‘display_errors’, 1);
}
echo ini_get(‘display_errors’);
?>
What is the difference between GROUP bY and ORDER BY?
GROUP BY: It is a way to sub-total your results,or perform
some other ‘aggregate’ functions on them.
ORDER BY: It is a simply a way to sort your results. It
doesn’t affect what shows up in your result set,only what
order it is displayed.
What is the difference between primary and unique key?
Primary Key: A column in a table whose values uniquely identify the rows in the table. A primary key value cannot be NULL.
Unique Key: Unique Keys are used to uniquely identify each row in an Oracle table. There can be one and only one row for each unique key value.
Surrogate Key: A system generated key with no business value. Usually implemented with database generated sequences.
What does a special set of tags = and ?> do in PHP?
The output is displayed directly to the browser.
What’s the difference between include and require?
It’s how they handle failures. If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.