Php Important Solved Programming Questions

aimtocode

PHP Important Question


Q 7) What is PHP?

The PHP Hpertext Pre-processor (PHP) is a programming language that allows web developers to create dynamix content that interacts with databases. PHP is a server side scripting language that is embedded in HTML.


Q 8) What is the purpose of php.ini file?

The PHP configuration file, php.ini, is the final and most immediate way to affect PHP's functionality. The php.ini file is read each time PHP is initialized.in other words, whenever httpd is restarted for the module version or with each script execution for the CGI version.


Q 9) What are PHP magic constants?

PHP provides a large number of predefined constants to any script which it runs known as magic constants.


Q 10) Why do we use PHP?

There are several benefits of using PHP. First of all, it is totally free to use. So anyone can use PHP without any cost and host the site at a minimal cost.


Q 11) What is meant by variable variables in PHP?

When the value of a variable is used as the name of the other variables then it is called variable variables. $$ is used to declare variable variables in PHP.

 $str = "PHP";
 $$str = " Programming"; //declaring variable variables

 echo "$str ${$str}"; //It will print "PHP programming"

 echo "$PHP"; //It will print "Programming"

Q 12) explode() function is used to split a string into an array and implode() function is used to make a string by combining the array elements.

 $text = "I like programming";

 print_r (explode(" ",$text));

 $strarr = array('Pen','Pencil','Eraser');

 echo implode(" ",$strarr);

Q 13) What is Zend Engine?

Zend Engine is used internally by PHP as a compiler and runtime engine. PHP Scripts are loaded into memory and compiled into Zend OPCodes.

These OPCodes are executed and the HTML generated is sent to the client.

The Zend Engine provides memory and resource management and other standard services for the PHP language. Its performance, reliability, and extensibility have played a significant role in PHP’s increasing popularity.


Q 14) What library is used for PDF in PHP?

The PDF functions in PHP can create PDF files using PDFlib version 6. PDFlib offers an object-oriented API for PHP5 in addition to the function-oriented API for PHP4. There is also the » Panda module.


Q 15) What are magic methods?

Magic methods are member functions that are available to all the instances of a class. Magic methods always start with ‘__’, for example, __construct(). All magic methods need to be declared as public.


Q 16) What is meant by PEAR in PHP?

PEAR is an acronym for PHP Extension and Application Repository. The purpose of PEAR is to provide:

  • A structured library of open-sourced code for PHP users
  • A system for code distribution and package maintenance
  • A standard style for writing code in PHP
  • PHP Foundation Classes (PFC)
  • PHP Extension Community Library (PECL)
  • A website, mailing lists, and download mirrors to support the PHP/PEAR community


Q 17) What is Smarty?

Smarty is a template engine written in PHP. Typically, these templates will include variables—like {$variable}—and a range of logical and loop operators to allow adaptability within the templates.


Q 18) What is Memcache?

Memcache is a technology that caches objects in memory such that a web application can get to them really fast. It is used by sites, such as Digg, Facebook, and NowPublic, and is widely recognized as an essential ingredient in scaling any LAMP.


Q 19) How can we execute a PHP script using a command line?

We just have to run the PHP CLI (Command-line Interface) program and provide the PHP script file name as the command-line argument, for example, php myScript.php, assuming php as the command to invoke the CLI program.


Q 20) What is the meaning of a final class and a final method?

'final' is introduced in PHP5. Final class means that this class cannot be extended and a final method cannot be overridden.

aimtocode