PHP Interview Questions and Answers for Experience

How to scrape data from website using CURL?

To scrap the data from website, Website must be public and open for scrapable.
In the blow code, just update the CURLOPT_URL to which websites data you want to scrap.

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.tutorialswebsite.com/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$output = curl_exec($ch);
curl_close($ch);
echo $output;

Explain the difference between $message and $$message?

  • $message is used to store variable data. $$message can be used to store variable of a variable. Data stored in $message is fixed while data stored in $$message can be changed dynamically.
    Example:
$var1 = ‘Variable 1’
$$var1= ‘variable2’
This can be interpreted as $ Variable 1=‘variable2’;
For me to print value of both variables, I will write
$var1 $($var1)
  • $message is a variable and $$message is a variable of another variable.
    Example
$Message = "YOU";
$you= "Me";
echo $message //Output:- you
echo $$message //output :-Me

$$message allows the developer to change the name of the variable dynamically.

How urlencode and urldecode can be used?

Urlencode can be used to encode a string that can be used in a url. It encodes the same way as posted data from web page is encoded. It returns the encoded string.
Syntax:

urlencode (string $str )

urlencode () is the function that can be used conveniently to encode a string before using in a query part of a URL. This is a convenient way for passing variables to the next page.
Syntax:

urldecode (string $str )

urldecode() is the function that is used to decode the encoded string. Urldecode can be used to decode a string. Decodes any %## encoding in the given string (Inserted by urlencode.)

How to set HTTP header to UTF-8 using?

header(‘Content-Type: text/html; charset=utf-8’);

Which PHP Extension help to debug the code?

Xdebug: – It uses the DBGp debugging protocol for debugging.
The debug information that Xdebug can provide includes the following:

  • stack and function traces in error messages with:
  • full parameter display for user defined functions
  • function name, file name and line indications
  • support for member functions
  • memory allocation
  • protection for infinite recursions

Xdebug also provides:

  • profiling information for PHP scripts
  • code coverage analysis
  • Capabilities to debug your scripts interactively with a debugger front-end.[4]
    Xdebug is also available via PECL

How can I execute an anonymous function?

call_user_func(function() { echo ‘anonymous function called.’; });

Explain how to send large amounts of emails using PHP.

There are different methods through which we can send mails in PHP. They are as follows:

  1. PHP mail() function
    It implicitly sends a message to SMTP server, which is configured in the php.ini file. This function is used by the base class of MIME message composing and sending package.
  2. SMTP server relay
    They are used to relay the messages to an intermediate SMTP server. This server stores the messages temporarily and will try to deliver them in the destination SMTP server.
  3. Sending urgent messages by doing direct delivery to the destination SMTP server
    A variable named direct_delivery is provided by the smtp_message_class sub-class, which connects to the destination SMTP server and sends the message directly.

How can I measure the speed of code written in PHP?

$startTime= microtime(true);
/** Write here you code to check **/
/** Write here you code to check **/
$endTime= microtime(true);
echo ‘Time Taken to execute the code:’.$endTime-$startTime

How can we resolve maximum allocation time exceeds error?

We can resolve these errors through php.ini file or through .htaccess file.

  1. From php.ini file, increase the max_execution_time =360 (or more according to need)
    and change memory_limit =128M (or more according to need)
  2. From php file, we can increase time by writing ini_set(‘max_execution_time’,360 ) at top of php page to increase the execution time.And to change memory_limit write ini_set(‘memory_limit ,128M )
  3. From .htaccess file, we can increase time and memory by:
<IfModule mod_php5>
php_value max_execution_time 3600
php_value memory_limit 128M
</IfModule>

 

In how many ways can you retrieve data in the result set of MySQL using PHP? What is the difference between mysql_fetch_object and mysql_fetch_array?

We can retrieve data in the result set of MySQL using PHP in four Ways

  1. mysqli_fetch_row >> Get a result row as an enumerated array
  2. mysqli_fetch_array >> Fetch a result row as associative and numeric array
  3. mysqli_fetch_object >> Returns the current row of a result set as an object
  4. mysqli_fetch_assoc >> Fetch a result row as an associative array
    mysqli_fetch_object() is similar to mysqli_fetch_array(), with one difference –
    an object is returned instead of an array, which implies that that we can only access the data by the field names, and not by their offsets (numbers are illegal property names).

Can we use include (“xyz.PHP”) two times in a PHP page “index.PHP”?

Yes, we can include (“xyz.php”) more than one time in any page. But it creates a problem when a xyz.php file contains some function declaration- an error occurs due to an already present function in this file. Otherwise, there is no problem, for instance if you want to show same content two times in the page then you must include it two times.

How do we change a password for an existing user via mysqladmin?

mysqladmin -u root -p password “newpassword”

How to Get the Uploaded File Information in the Receiving Script?

Once the Web server received the uploaded file, it will call the PHP script specified in the form action attribute to process them. This received PHP script can get the uploaded file information through a predefined array called $_FILES. Uploaded file information is organized in $_FILES as a two-dimensional array as:

  • $_FILES[$fieldName][‘name’] : Original file name on the browser system.
  • $_FILES[$fieldName][‘type’] : the file type determined by the browser.
  • $_FILES[$fieldName][‘size’] : Number of bytes of the file content.
  • $_FILES[$fieldName][‘tmp_name’] : a temporary filename of the file in which the uploaded file was stored on the server.
  • $_FILES[$fieldName][‘error’] an error code associated with this file upload.
  • The $fieldName is the name used in the <INPUT,>.

How can we destroy a session in PHP?

We can destroy a session by:

<?php
session_destroy();
?>

To delete a specific session variable, we use

<?php
session_unset($_SESSION['variable_name']);
?>

What will be the output of following?

function changevalue(&$y){

$y=$y+7;

}

$num=8;

changevalue($num);

echo $num;

It would be: 15
Reference will take the value and will add 5 to it.

Regional | Current Affairs Jan 2019

  • Amul Camel Milk Launched in Markets in Gujarat.
  • Andaman Airport has been confirmed as an authorized immigration check post.
  • Andhra Pradesh CM Chandrababu Naidu has launched ‘ NCBN App ‘. The app will provide updates to real-time media and behave as a platform for local people to interact with govt.
  • Haryana Government Approved 11 Saraswati River Resurrection Projects. Under the project, the agency will restart the mythical Saraswati River to find the continuous fresh water stream into it.
  • The National Green Tribunal (NGT) punished the Meghalaya government with penalty of Rs 100 crore as it neglected to record the state’s illegal coal mining. Most of the mines in the northwestern portion of the state were working without a formal lease or permit.
  • Minister of Road Transport, Nitin Gadkari, announced Costing Rs 5,300 Crore projects in Jodhpur.
  • Mr. Naveen Patnaik, Odisha’s chief minister, announced interest-free loan in the state for women’s self-help groups (WSHGs) up to Rs lakh. He generated the announcement while introducing the “Mission Shakti” conference.
  • Karnataka State Tourism Development Corporation (KSTDC) has launched an exclusive women’s taxi company. Only females will ride the special taxi system launched by KSTDC at Kempegowda International Airport, Bengaluru.
  • After receiving permission from the Lok Sabha, the Rajya Sabha also passed the Bill demanding 10 quota for the economically poor in the general category.
  • Byorung Bridge, Indian Single Lane Steel Cable Bridge Opened in Arunachal Pradesh.
  • Chandrababu Naidu launched the 7th Andhra Pradesh Airport.
  • Sikkim’s chief minister, Pawan Kumar Chamling, launched the system ‘ One Family, One Job. ‘ The scheme’s goal is to provide employment for one person of each family who does not have government job in the state.
  • Gujarat has become the first state to adopt quota of 10% for economically weaker sections
  • Mr. Pinarayi Vijayan, Kerala’s chief minister, launched the biggest start-up ecosystem in India. The environment is built up in Kochi, Kerala, with touch of modern technology.
  • The government of Uttar Pradesh altered Mughalsarai tehsil’s title to “Deen Dayal Upadhyay Nagar Tehsil.” Uttar Pradesh’s cabinet approved the suggestion that Mughalsarai tehsil be renamed.
  • Naveen Patnaik, Odisha’s chief minister, announced to all state medical schools and clinics free dental facilities. From February 2019, the free medical services provided under Biju Swasthya Kalyan Yojana will be available.
  • HD Kumaraswamy, Karnataka’s chief minister, is set to inaugurate on February 2019 ‘ Vivek Smarak, ‘ the Swami Vivekananda Value Education and Cultural Centre.
  • Government of Telangana Establish ‘ Save Tiger Protection Force ‘.
  • Rajiv Gandhi International Airport, Hyderabad will have the terminal entry system based on face recognition in the near future.
  • Vizag has become the only major port to Fulfil Energy Requirement from Solar Power

What is debugging?

Debugging is the process of identifying errors within a program. During program compilation, errors that are found will stop the program from executing completely. At this state, the programmer would look into the possible portions where the error occurred. Debugging ensures the removal of errors, and plays an important role in ensuring that the expected program output is met.

When is the “void” keyword used in a function?

When declaring functions, you will decide whether that function would be returning a value or not. If that function will not return a value, such as when the purpose of a function is to display some outputs on the screen, then “void” is to be placed at the leftmost part of the function header.

When a return value is expected after the function execution, the data type of the return value is placed instead of “void”.

How do you access the values within an array?

Arrays contain a number of elements, depending on the size you gave it during variable declaration. Each element is assigned a number from 0 to number of elements-1. To assign or retrieve the value of a particular element, refer to the element number. For example: if you have a declaration that says “intscores[5];”, then you have 5 accessible elements, namely: scores[0], scores[1], scores[2], scores[3] and scores[4].

What are variables and it what way is it different from constants?

Variables and constants may at first look similar in a sense that both are identifiers made up of one character or more characters (letters, numbers and a few allowable symbols). Both will also hold a particular value.  Values held by a variable can be altered throughout the program, and can be used in most operations and computations. Constants are given values at one time only, placed at the beginning of a program. This value is not altered in the program. For example, you can assigned a constant named PI and give it a value 3.1415  .  You can then use it as PI in the program, instead of having to write 3.1415 each time you need it. 

What is syntax error?

Syntax errors are associated with mistakes in the use of a programming language. It maybe a command that was misspelled or a command that must was entered in lowercase mode but was instead entered with an upper case character. A misplaced symbol, or lack of symbol, somewhere within a line of code can also lead to syntax error.

What are header files and what are its uses in C programming?

Header files are also known as library files. They contain two essential things: the definitions and prototypes of functions being used in a program.

Simply put, commands that you use in C programming are actually functions that are defined from within each header files. Each header file contains a set of functions.

For example:

stdio.h is a header file that contains definition and prototypes of commands like printf and scanf. 

Can the curly brackets { } be used to enclose a single line of code?

While curly brackets are mainly used to group several lines of codes, it will still work without error if you used it for a single line. Some programmers prefer this method as a way of organizing codes to make it look clearer, especially in conditional statements.

Difference between compilers and interpreters ?

Compilers and interpreters often deal with how program codes are executed.

Interpreters execute program codes one line at a time, while compilers take the program as a whole and convert it into object code, before executing it.

The key difference here is that in the case of interpreters, a program may encounter syntax errors in the middle of execution, and will stop from there. On the other hand, compilers check the syntax of the entire program and will only proceed to execution when no syntax errors are found.

What is the default value of local and global variables?

Local variables get garbage value and global variables get a value 0 by default.

What are enumerations?

Enumerations are list of integer constants with name. Enumerators are defined with the keyword enum.

What is the advantage of declaring void pointers?

When we do not know what type of the memory address the pointer variable is going to hold, then we declare a void pointer for such.

What is a NULL pointer?

A pointer pointing to nothing is called so. Eg: char *p=NULL;

What is a static variable?

A static local variables retains its value between the function call and the default value is 0. The following function will print 1 2 3 if called thrice.

<span class="kwd">void</span><span class="pln"> f</span><span class="pun">()</span> <span class="pun">{</span> 
   <span class="kwd">static</span> <span class="kwd">int</span><span class="pln"> i</span><span class="pun">;</span> 
   <span class="pun">++</span><span class="pln">i</span><span class="pun">;</span><span class="pln"> 
   printf</span><span class="pun">(“%</span><span class="pln">d </span><span class="pun">“,</span><span class="pln">i</span><span class="pun">);</span> 
<span class="pun">}</span>

If a global variable is static then its visibility is limited to the same source code.

How a negative integer is stored.

Get the two’s compliment of the same positive integer. Eg: 1011 (-5)

Step-1 − One’s compliment of 5 : 1010

Step-2 − Add 1 to above, giving 1011, which is -5

Which of the following operators is incorrect and why? ( >=, <=, <>, ==)

<> is incorrect. While this operator is correctly interpreted as “not  equal to” in writing conditional statements, it is not the proper operator to be used in C programming. Instead, the operator  !=  must be used to indicate “not equal to” condition.

What is a nested loop?

A nested loop is a loop that runs within another loop. Put it in another sense, you have an inner loop that is inside an outer loop. In this scenario, the inner loop is performed a number of times as specified by the outer loop. For each turn on the outer loop, the inner loop is first performed.

What is the modulus operator?

The modulus operator outputs the remainder of a division. It makes use of the percentage (%) symbol. For example: 10 % 3 = 1, meaning when you divide 10 by 3, the remainder is 1.

What is the difference between the = symbol and == symbol?

The = symbol is often used in mathematical operations. It is used to assign a value to a given variable. On the other hand, the == symbol, also known as “equal to” or “equivalent to”, is a relational operator that is used to compare two values.

What is the use of a ‘\0’ character?

It is referred to as a terminating null character, and is used primarily to show the end of a string value.

In C programming, how do you insert quote characters (‘ and “) into the output screen?

This is a common problem for beginners because quotes are normally part of a printf statement. To insert the quote character as part of the output, use the format specifiers \’ (for single quote), and \” (for double quote).

Differentiate Source Codes from Object Codes

Source codes are codes that were written by the programmer. It is made up of the commands and other English-like keywords that are supposed to instruct the computer what to do. However, computers would not be able to understand source codes. Therefore, source codes are compiled using a compiler. The resulting outputs are object codes, which are in a format that can be understood by the computer processor. In C programming, source codes are saved with the file extension .C, while object codes are saved with the file extension .OBJ

What is variable initialization and why is it important?

This refers to the process wherein a variable is assigned an initial value before it is used in the program. Without initialization, a variable would have an unknown value, which can lead to unpredictable outputs when used in computations or other operations.

What is difference between uninitialized pointer and null pointer?

An uninitialized pointer is a pointer which points unknown memory location while null pointer is pointer which points a null value or base address of segment. For example:

int *p;   //Uninitialized pointer

int *q= (int *)0;  //Null pointer

#include<stdio.h>

int *r=NULL;   //Null pointer

What will be output of following c program?

#include<string.h>

#include<stdio.h>

int main(){

char *p;  //Uninitialized pointer

char *q=NULL;   //Null pointer;

strcpy(p,”cquestionbank”);

strcpy(q,”cquestionbank”);

 

printf(“%s  %s”,p,q);

return 0;

}

Output: cquestionbank (null)

What is size of void pointer?

Size of any type of pointer in c is independent of data type which is pointer is pointing i.e. size of all type of pointer (near) in c is two byte either it is char pointer, double pointer, function pointer or null pointer.  Void pointer is not exception of this rule and size of void pointer is also two byte.

What is the meaning of prototype of a function?

Prototype of a function

Declaration of function is known as prototype of a function. Prototype of a function means

(1) What is return type of function?

(2) What parameters are we passing?

(3) For example prototype of printf function is:

int printf(const char *, …);

I.e. its return type is int data type, its first parameter constant character pointer and second parameter is ellipsis i.e. variable number of arguments.

Why we use do-while loop in c?

It is also called as post tested loop. It is used when it is necessary to execute the loop at least one time. Syntax:

do {

Loop body

} while (Expression);

Example:

int main(){

int num,i=0;

do{

printf(“To enter press 1\n”);

printf(“To exit press  2”);

scanf(“%d”,&num);

++i;

switch(num){

case 1:printf(“You are welcome\n”);break;

default : exit(0);

}

}

while(i<=10);

return 0;

}

Output: 3 3 4 4

Explain the syntax for for loop.

Syntax:

Do you know memory representation of int a = 7 ?

Memory representation of:

signed int a=7;         (In Turbo c compiler)

signed short int a=7 (Both turbo c and Linux gcc compiler)

Binary equivalent of data 7 in 16 bit:  00000000 00000111

Data bit: 0000000 00000111 (Take first 15 bit form right side)

Sign bit: 0 (Take leftmost one bit)

First eight bit of data bit from right side i.e. 00000111 will store in the leftmost byte from right to left side and rest seven bit of data bit i.e. 0000000 will store in rightmost byte from right to left side as shown in the following figure:

What are merits and demerits of array in c?

Merits:

(a) We can easily access each element of array.

(b) Not necessity to declare too many variables.

(c) Array elements are stored in continuous memory location.

Demerit:

(a) Wastage of memory space. We cannot change size of array at the run time.

(b) It can store only similar type of data.

What is a sequential access file?

When writing programs that will store and retrieve data in a file, it is possible to designate that file into different forms. A sequential access file is such that data are saved in sequential order: one data is placed into the file after another. To access a particular data within the sequential access file, data has to be read one data at a time, until the right one is reached.

What is a stack?

A stack is one form of a data structure. Data is stored in stacks using the FILO (First In Last Out) approach. At any particular instance, only the top of the stack is accessible, which means that in order to retrieve data that is stored inside the stack, those on the upper part should be extracted first. Storing data in a stack is also referred to as a PUSH, while data retrieval is referred to as a POP.

Some coders debug their programs by placing comment symbols on some codes instead of deleting it. How does this aid in debugging?

Placing comment symbols /* */ around a code, also referred to as “commenting out”, is a way of isolating some codes that you think maybe causing errors in the program, without deleting the code. The idea is that if the code is in fact correct, you simply remove the comment symbols and continue on. It also saves you time and effort on having to retype the codes if you have deleted it in the first place.

What are the valid places for the keyword break to appear.

Break can appear only with in the looping control and switch statement. The purpose of the break is to bring the control out from the said blocks.

Swap two variables without using third variable.

#include<stdio.h>

int main(){

int a=5,b=10;

//process one

a=b+a;

b=a-b;

a=a-b;

printf(“a= %d  b=  %d”,a,b);

//process two

a=5;

b=10;

a=a+b-(b=a);

printf(“\na= %d  b=  %d”,a,b);

//process three

a=5;

b=10;

a=a^b;

b=a^b;

a=b^a;

printf(“\na= %d  b=  %d”,a,b);

 

//process four

a=5;

b=10;

a=b-~a-1;

b=a+~b+1;

a=a+~b+1;

printf(“\na= %d  b=  %d”,a,b);

 

//process five

a=5,

b=10;

a=b+a,b=a-b,a=a-b;

printf(“\na= %d  b=  %d”,a,b);

return 0;

}

Write a c program to print Hello world without using any semicolon

void main(){

if(printf(“Hello world”)){

}

}

Solution: 2

void main(){

while(!printf(“Hello world”)){

}

}

Solution: 3

void main(){

switch(printf(“Hello world”)){

}

}

What is dangling pointer in c?

Dangling pointer:

If any pointer is pointing the memory address of any variable but after some variable has deleted from that memory location while pointer is still pointing such memory location. Such pointer is known as dangling pointer and this problem is known as dangling pointer problem.

A pointer initially holding valid address, but later the held address is released or freed. Then such a pointer is called as dangling pointer

Distinguish between malloc() & calloc() memory allocation

There are two major differences between malloc and calloc in C programming language: first, in the number of arguments. The malloc() takes a single argument, while calloc() takess two. Second, malloc() does not initialize the memory allocated, while calloc() initializes the allocated memory to ZERO.

Both malloc and calloc are used in C language for dynamic memory allocation they obtain blocks of memory dynamically. Dynamic memory allocation is a unique feature of C language that enables us to create data types and structures of any size and length suitable to our programs.

What is the difference between Call by Value and Call by Reference?

When using Call by Value, you are sending the value of a variable as parameter to a function, whereas Call by Reference sends the address of the variable. Also, under Call by Value, the value in the parameter is not affected by whatever operation that takes place, while in the case of Call by Reference, values can be affected by the process within the function.

How do you construct an increment statement or decrement statement in C?

There are actually two ways you can do this. One is to use the increment operator ++ and decrement operator –. For example, the statement “x++” means to increment the value of x by 1. Likewise, the statement “x –” means to decrement the value of x by 1. Another way of writing increment statements is to use the conventional + plus sign or – minus sign. In the case of “x++”, another way to write it is “x = x +1”.

What is a preprocessor?

Preprocessor is a directive to the compiler to perform certain things before the actual compilation process begins.

What are some new features introduced in PHP7?

  1. Zend Engine 3 performance improvements and 64-bit integer support on Windows
  2. uniform variable syntax AST-based compilation process
  3. added Closure::call()
  4. bitwise shift consistency across platforms
  5. (null coalesce) operator
  6. Unicode codepoint escape syntax
  7. return type declarations
  8. and scalar type (integer, float, string and boolean) declarations.

What is htaccess? Why do we use this and where?

  • htaccess files are configuration files of Apache Server that provide a way to make configuration changes on a per-directory basis. A file, containing one or more configuration directives, is placed in a particular document directory, and the directives apply to that directory, and all subdirectories thereof.
  • These .htaccess files are used to change the functionality and features of Apache web server.
    For instance, htaccess file is used for url rewrite.
    –> It is used to make the site password protected.
    –> .htaccess file can restrict some ip addresses so that on restricted ip addresses, the site will not open.

What are magic functions?

  • Magic methods are member functions that are available to all the instance of class. Magic methods always start with “__”. Eg. __construct.
  • All magic methods need to be declared as public
  • To use a method, it should be defined within the class or program scope
  • Various Magic Methods used in PHP 5 are: __construct() __destruct() __set() __get() __call() __toString() __sleep() __wakeup() __isset() __unset() __autoload() __clone().

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

Explain soundex() and metaphone().

soundex()
The soundex() function calculates the soundex key of a string. A soundex key is a four character long alphanumeric strings that represents English pronunciation of a word. The soundex() function can be used for spelling applications.

<?php
$str= “hello”;
Echo soundex($str);
?>

metaphone()
the metaphone() function calculates the metaphone key of a string. A metaphone key represents how a string sounds if pronounced by an English person. This function can also be used for spelling applications.

<?php
echo metaphone(“world”);
?>

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 of the template.

What is Memcache?

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

How can we execute a PHP script using command line?

  • Just 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” is the command to invoke the CLI program.
  • Remember that if your PHP script was written for the Web CGI interface, it may not execute properly in command line environment.

How can we encrypt password using PHP?

crypt () function is used to create one way encryption. It takes one input string and one optional parameter. The function is defined as: crypt (input_string, salt), where input_string consists of the string that has to be encrypted and salt is an optional parameter. PHP uses DES for encryption. The format is as follows:

<?php

$password= crypt("tutorialswebsite");

echo $password." is the encrypted version of tutorialswebsite";
?>

 

Explain how to submit a Form without a submit button?

A form can be posted or submitted without the button in the following ways:

1. On OnClick event of a label in the form, a JavaScript function can be called to submit the form.
Example:

  document.form_name.submit()

2. Using a Hyperlink: On clicking the link, JavaScript function can be called.

Example:

<a href="javascript:document.MyForm.submit();">

A form can be submitted in these other ways without using submit button.

  • Submitting a form by clicking a link
  • Submitting a form by selecting an option from drop down box with the invocation of onChange event
  • Using java script : document.form.submit();
  • Using header(“location:page.php”);

How can we increase the execution time of a PHP script?

  • Default time allowed for the PHP scripts to execute is 30 secs mentioned in the php.inifile. The function used is set_time_limit(int sec). If the value passed is ‘0’, it takes unlimited time. It should be noted that if the default timer is set to 30 sec, and 20 sec is specified in set_time_limit(), the script will run for 45 seconds.
  • This time can be increased by modifying the max_execution_time in secs. The time must be changed keeping the environment of the server. This is because modifying the execution time will affect all the sites hosted by the server.
  • The script execution time can be increased by
  1. Using sleep() function in PHP script
  2. Using set_time_limit() function
  3. The default limit is 30 seconds. The time limit can be set to zero to impose no time limit to pause.

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 played a significant role in PHP’s increasing popularity.

What library is used for pdf in PHP?

The PDF functions in PHP can create PDF files using the PDFlib library Version 6. PDFlib offers an object-oriented API for PHP 5 in addition to the function-oriented API for PHP 4.
There is also the » Panda module. FPDF is a PHP class, which allows generating PDF files with pure PHP (without using the PDFlib library.)
F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs. FPDF requires no extension (except zlib to activate compression and GD for GIF support) and works with PHP4 and PHP5.