Professional Documents
Culture Documents
Bu Mba 2 Sem Cp-208 Project Management 2012
Bu Mba 2 Sem Cp-208 Project Management 2012
Answer # php is called hypertext pre-processor as its libraries are already compiled.
When any person request for any php page in the address bar of the browser that
request is first sent to the server then server interpret php files and return back response
in form of Html.
Answer # HTML is a language used to describe to a browser how to display text and
other objects in a browser window. It is not a programming language. HTML works on a
client computer (the system on which the page is being viewed). PHP is a scripting
language, and can be used to create web pages written in HTML.
Answer # PHP 5 is a server scripting language, and a powerful tool for making dynamic
and interactive Web pages. PHP is a widely-used, free, and efficient alternative to
competitors such as Microsoft’s ASP.
Answer # PHP is mainly focused on server-side scripting, so you can do anything any
other CGI program can do, such as collect form data, generate dynamic page content, or
send and receive cookies. But PHP can do much more. There are three main areas where
PHP scripts are used. Server-side scripting.
Question # 7) What is the difference between PHP and Javascript?
Answer # While JS is used for client side scripting (except in node.js) and PHP is used
for server side scripting. Simply, JavaScript codes are executed by your web browser,
like the catchy animations or simple calculations . Your browser does all the processing.
While PHP runs on the server, where your webpage is stored.
Answer # HTML is a language used to describe to a browser how to display text and
other objects in a browser window. It is not a programming language. HTML works on a
client computer (the system on which the page is being viewed). PHP is a scripting
language, and can be used to create web pages written in HTML.
Answer # PHP is a language that’s made for the web. You can make GTK and CLI
applications with PHP, but it’s mainly used for websites. Python is used for a lot of stuff
like websites, webservers, game frameworks, desktop and CLI application, IDEs and a
lot more. There’s also a huge difference in the syntax.
Answer # The PHP software works with the web server, which is the software that
delivers web pages to the world. You request a file, the web server happens to be
running PHP, and it sends HTML back to the browser, thanks to the programming in
PHP.
Answer # PHP is commonly written in-line in the same files as HTML and Javascript,
PHP is a server-side language. Javascript is a client-side language. The main difference
here is not PHP vs. JavaScript. It’s Client vs. Server. You can’t do server stuff on the
client, and you can’t do all the Client stuff on the Server.
Question # 17) What is the main difference between asp net and PHP?
Answer # the session id is sent to the user when his session is created. it is stored in a
cookie (called, by default, PHPSESSID ) that cookie is sent by the browser to the server
with each request. the server (PHP) uses that cookie, containing the session_id, to know
which file corresponds to that user.
Answer # If you want to explicitly end a user’s and delete their data without them having
to close their browser, you need to clear the $_SESSION array, then use the
session_destroy() function. Session_destroy() removes all session data stored on your
hard disk, leaving you with a clean slate.
Question # 20) What are the advantages of PHP mysql?
Answer # It is a stable, reliable and powerful solution with advanced features like the
following:
Data Security
On-Demand Scalability
High Performance
Round-the-clock Uptime
Comprehensive Transactional Support
Complete Workflow Control
Reduced Total Cost of Ownership
The Flexibility of Open Source
Answer # PHP and Java are both very similar when it comes to the benefits provided,
but they are both very different. PHP is a server side scripting language, while Java is a
client side choice. When you use PHP code, you will execute it in the actual server, while
Java will be executed on your client’s computer.
Step 1: download the files. Download the latest PHP 5 ZIP package from
www.php.net/downloads.php
Answer # This can be used to persist state information between page requests. Session
IDs are normally sent to the browser via session cookies and the ID is used to retrieve
existing session data. PHP will populate the $_SESSION superglobal with any session
data after the session has started.
Answer # This is the one. The session will last for 1440 seconds (24 minutes).
Answer # PHP is the most popular scripting language for web development. It is free,
open source and server-side (the code is executed on the server). MySQL is a Relational
Database Management System (RDBMS) that uses Structured Query Language (SQL).
Answer # It may surprise you to learn that JavaScript and jQuery are actually the same
thing. In a nutshell, jQuery is a set of JavaScript libraries that have been designed
specifically to simplify HTML document traversing, animation, event handling, and Ajax
interactions.
PHP Interview Questions And Answers
Question # 27) What is the difference between interpreted and compiled languages?
Answer # Java (interpreted) and C (or C++) (compiled) might have been a better
example. Basically, compiled code can be executed directly by the computer’s CPU. The
code of interpreted languages however must be translated at run-time from any format
to CPU machine instructions. This translation is done by an interpreter.
Answer # A cookie is often used to identify a user. A cookie is a small file that the server
embeds on the user’s computer. Each time the same computer requests a page with a
browser, it will send the cookie too. With PHP, you can both create and retrieve cookie
values.
Answer # A session is a global variable stored on the server. Each session is assigned a
unique id which is used to retrieve stored values. Sessions have the capacity to store
relatively large data compared to cookies. The session values are automatically deleted
when the browser is closed.
Question # 31) What is in PHP 7?
Answer # Designed and refactored for today’s workloads, PHP 7 is the ultimate choice
for web developers today. Get started now. Faster performance, less resources, and cool
new features like scalar type declarations, the Spaceship Operator, anonymous classes,
and more.
Answer # In the PHP world, apparantly uninitialized variables have the Null value, and
is set on such a variable returns FALSE.
Answer # Traits are a mechanism for code reuse in single inheritance languages such as
PHP. A Trait is intended to reduce some limitations of single inheritance by enabling a
developer to reuse sets of methods freely in several independent classes living in
different class hierarchies.
Answer # The is_null () function is used to test whether a variable is NULL or not.
*Mixed : Mixed indicates that a parameter may accept multiple (but not necessarily all)
types. Returns TRUE if var_name is null, FALSE otherwise.
Answer # An empty string is a value, but is just empty. Null is special to a database. Null
has no bounds, it can be used for string , integer , date , etc. fields in a database. NULL
isn’t allocated any memory, the string with NUll value is just a pointer which is pointing
to nowhere in memory.
Answer # PHP 5 introduces the final keyword, which prevents child classes from
overriding a method by prefixing the definition with final. If the class itself is being
defined final then it cannot be extended.
Answer # PHP callback are functions that may be called dynamically by PHP. They are
used by native functions such as array_map, usort, preg_replace_callback, etc. Here is a
reminder of the various ways to create a callback function in PHP, and use it with the
native functions.
Answer # To sum up, a lambda function is an anonymous PHP function that can be
stored in a variable and passed as an argument to other functions or methods. A closure
is a lambda function that is aware of its surrounding context.
Answer # Overloading is defining functions that have similar signatures, yet have
different parameters. Overriding is only pertinent to derived classes, where the parent
class has defined a method and the derived class wishes to override that method. In
PHP, you can only overload methods using the magic method __call.
Answer # PHP Booleans. A Boolean value is one that is in either of two states. They are
known as True or False values, in programming. True is usually given a value of 1, and
False is given a value of zero.
Answer # prinf : It is a function which takes atleast one string and format style and
returns length of output string. print_r() is used for printing the array in human
readable format. they both are language constructs. echo returns void and print returns
1.
Answer # Anonymous functions, also known as closures, allow the creation of functions
which have no specified name. They are most useful as the value of callback parameters,
but they have many other uses. Anonymous functions are implemented using the
Closure class.
Answer # (PHP 4, PHP 5, PHP 7) return returns program control to the calling module.
Execution resumes at the expression following the called module’s invocation. If called
from within a function, the return statement immediately ends execution of the current
function, and returns its argument as the value of the function call.
Answer # The die() function prints a message and exits the current script. This function
is an alias of the exit() function.
Answer # PHP Arrays – An array is a data structure that stores one or more similar type
of values in a single value. For example if you want to store 100 numbers then instead of
defining 100 variables its easy to define an array of 100 length.
Answer # Similiar to the HTML comment, the multi-line PHP comment can be used to
comment out large blocks of code or writing multiple line comments. The multiple line
PHP comment begins with ” /* ” and ends with ” */ “.
Answer # They are both variables. But $message is a variable with a fixed name. $
$message is a variable who’s name is stored in $message. For example, if $message
contains “var”, $$message is the same as $var.
Question # 54) What is the difference between require and include in PHP?
Answer # Require and include functions does the same task i.e. includes and evaluates
specified file, but the difference is require will cause a fatal error when the specified file
location is invalid or for any error where as include will generate a warning and continue
the code execution.
1. Warning errors
2. Notice errors
3. Fatal errors
4. Parse errors
Answer #
Answer # The include_once statement includes and evaluates the specified file during
the execution of the script. This is a behavior similar to the include statement, with the
only difference being that if the code from a file has already been included, it will not be
included again, and include_once returns TRUE .
Answer # With PHP 5 came a new object oriented way of dealing with errors. Exception
handling is used to change the normal flow of the code execution if a specified error
(exceptional) condition occurs. This condition is called an exception.
Answer # GET can’t be used to send binary data, like images or word documents, to the
server. The data sent by GET method can be accessed using QUERY_STRING
environment variable. The PHP provides $_GET associative array to access all the sent
information using GET method. The POST method transfers information via HTTP
headers.
Answer # When the user fills out the form above and clicks the submit button, the form
data is sent for processing to a PHP file named “welcome.php”. The form data is sent
with the HTTP POST method. To display the submitted data you could simply echo all
the variables.
Question # 61) What is the difference between require_once and require in PHP?
Answer # require() includes and evaluates a specific file, while require_once() does that
only if it has not been included before (on the same page). So, require_once() is
recommended to use when you want to include a file where you have a lot of functions
for example.
Answer # The die() function prints a message and exits the current script. This function
is an alias of the exit() function.
Answer # To run a debugging session: Start the ide and open the file that contains the
source code that you want to debug. Set a breakpoint at each line where you want the
debugger to pause. To set a breakpoint, place the cursor at the beginning of a line and
press Ctrl-F8/⌘-F8 or choose Debug > Toggle Line Breakpoint.
Answer # Chrome Logger is a Google Chrome extension for debugging server side
applications in the Chrome console. Most languages include their own logging
capabilities, but sometimes it is easier to see your logs right in the browser. Chrome
Logger used to be known as ChromePHP.
urldecode(string) – This PHP function id decodes any encoded value in the given string.
Answer #
Answer # Database Storage Capacity. MySQL is limited by the largest file size that the
operating system you run it on can handle (between 4Gb and 256Tb depending on the
O/S). With the innoDB table format you can even span multiple files with one table
allowing for tables in the database of up to 64Tb.
Answer # In InnoDB, with a limit on table size of 64 terabytes and a MySQL row-size
limit of 65,535 there can be 1,073,741,824 rows. That would be minimum number of
records utilizing maximum row-size limit. However, more records can be added if the
row size is smaller.
Answer # MySQL 5.0 Column Count Limits: There is a hard limit of 4096 columns per
table, but the effective maximum may be less for a given table. The exact limit depends
on several interacting factors. Every table (regardless of storage engine) has a maximum
row size of 65,535 bytes.
Answer # Values in VARCHAR columns are variable-length strings. The length can be
specified as a value from 0 to 65,535. The effective maximum length of a VARCHAR is
subject to the maximum row size (65,535 bytes, which is shared among all columns) and
the character set used.
PHP Programming Interview Questions
Answer # n defines the string length and can be a value from 1 through 8,000. max
indicates that the maximum storage size is 2^31-1 bytes (2 GB). The storage size is the
actual length of the data entered + 2 bytes. The ISO synonyms for varchar are
charvarying or charactervarying.
Answer # The MySQL trigger is a database object that is associated with a table. It will
be activated when a defined action is executed for the table. The trigger can be executed
when you run one of the following MySQL statements on the table: INSERT, UPDATE
and DELETE and it can be invoked before or after the event.
Answer # In Nvarchar “n” defines the string length and can be a value from 1 through
4,000. max indicates that the maximum storage size is 2^31-1 bytes (2 GB). The storage
size, in bytes, is two times the actual length of data entered + 2 bytes. The ISO synonyms
for nvarchar are national char varying and national character varying.
Answer # delimiter is the marker for the end of each command you send to the mysql
command line client. delimiter is not only related to triggers, but defining triggers and
stored procedures is one strong use case as you wish them to contain semicolons (;)
which are otherwise the default delimiter.
Answer # All stored programs (procedures, functions, triggers, and events) and views
can have a DEFINER attribute that names a MySQL account. If the DEFINER attribute
is omitted from a stored program or view definition, the default account is the user who
creates the object.
Answer # The benefits of using stored procedures in SQL Server rather than application
code stored locally on client computers include: They allow modular programming.
They allow faster execution. They can reduce network traffic.
Answer # Limit Data Selections From a MySQL Database. MySQL provides a LIMIT
clause that is used to specify the number of records to return. The LIMIT clause makes it
easy to code multi page results or pagination with SQL, and is very useful on large
tables. Returning a large number of records can impact on performance.
PHP Interview Questions And Answers
Answer # The DUAL table is a special one-row, one-column table present by default in
Oracle and other database installations. In Oracle, the table has a single VARCHAR2(1)
column called DUMMY that has a value of ‘X’. It is suitable for use in selecting a pseudo
column such as SYSDATE or USER.
Answer # The MySQL INNER JOIN clause matches rows in one table with rows in other
tables and allows you to query rows that contain columns from both tables. The INNER
JOIN clause is an optional part of the SELECT statement.
Question # 87) What is the difference between an inner and outer join?
Answer # An inner join will only select records where the joined keys are in both
specified tables. A left outer join will select all records from the first table, and any
records in the second table that match the joined keys.
Answer # Both MySQL and PostgreSQL support a really cool feature called OFFSET that
is usually used with a LIMIT clause. The LIMIT clause is used to limit the number of
results returned in a SQL statement.
Answer # soundex and metaphone can be used to find strings that sound similar when
pronounced out loud.
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.
Answer # The parse_ini_file() function parses a configuration (ini) file and returns the
settings.
Answer # Traits are a mechanism for code reuse in single inheritance languages such as
PHP. A Trait is intended to reduce some limitations of single inheritance by enabling a
developer to reuse sets of methods freely in several independent classes living in
different class hierarchies.
Answer # The main difference is that, with interfaces, you must define the actual
implementation of each method within each class that implements said interface, so you
can have many classes implement the same interface but with different behavior, while
traits are just chunks of code injected in a class.
Answer #
<?php
trait ezcReflectionReturnInfo {
use ezcReflectionReturnInfo;
/* … */
/* … */
?>
Question # 97) Is there an easy way to delete an element from a PHP array?
Answer # If we want to delete just one array element you can use unset() method or
alternative array_splice() method. Also if you have the value and don’t know the key to
delete the element you can use array_search() method to get the key.
Question # 98) Can you explain, when to use If-else if-else over switch statements?
Question # 99) When do you use define() and when do you use const. What are the
main differences between those two?
Answer # PHP 5.3 there are two ways to define constants: Either using the const
keyword or using the define() function:
const FOO = ‘BAR’;
define(‘FOO’, ‘BAR’);
The fundamental difference between those two ways is that const defines constants at
compile time, whereas define() defines them at runtime. As const are language
constructs and defined at compile time they are a bit faster than define().
Answer # In PHP self keyword is used to access static properties and methods.
Answer # It is the way to reference an instance of a class from within itself, the same as
many other object-oriented languages. $this refers to the class you are in. In PHP, the
pseudo-variable $this is available when a method is called from within an object
context.
Answer # Use $this to refer to the current object. Use self to refer to the current class.
Answer # There are different web servers available for different technologies.
Answer # The Apache HTTP server and NGINX are the two most popular open source
web servers in the world today. The Apache web servers have been in use since 1995.
Apache powers more websites than any other product. Because the open-source Apache
web server has been available for so many years, and has so many users, lots of modules
have been written to expand its functionality.
But Apache slows down under heavy load, because of the need to spawn new processes,
thus consuming more computer memory. It also creates new threads that must compete
with others for access to memory and CPU. Apache will also refuse new connections
when traffic reaches the limit of processes configured by the administrator.
Nginx is an open source web server written to address some of the performance and
scalability issues associated with Apache. The product is open source and free, but
Nginx offers support if you buy its Nginx Plus version. Nginx is indeed event-based.
They call their architecture “event-driven and asynchronous”. Apache relies on
processes and threads.
Answer # .htaccess is a configuration file for use on web servers running the Apache
Web Server software. When a .htaccess file is placed in a directory which is in turn
‘loaded via the Apache Web Server’, then the .htaccess file is detected and executed by
the Apache Web Server software.
URL redirecting
Managing error pages
Password Protection
Visitor blocking facilities by IP address
Setting Config variable and Environment variable
Answer # Using this below code, we can redirect a URL from http to https
RewriteEngine on
RewriteCond %{HTTPS} off
Question # 110) How to redirect https to http URL and vice versa in .htaccess?
Answer # Using this below code, we can redirect a URL from http to https
RewriteEngine On
RewriteCond %{HTTPS} on
Answer # Artisan is the name of the command-line interface included with Laravel. It
provides a number of helpful commands for your use while developing your application.
It is driven by the powerful Symfony Console component.
$a === $b │ Identical │ TRUE if $a is equal to $b, and they are of the same type.
Answers: $i = 012;
echo $i / 2;
Explanation: You might think that output for the above code is 6 right. That’s the wrong
answer. But the correct output should be 5. The zero indicates at the beginning of a
number as an octal number in PHP, so the number 012 evaluates to the decimal number
10 instead to decimal 12. Then the output should be 5.
Answers # SQL injection (or a SQL injection attack) occurs when a user provides SQL
code as user input for a Web page, and the SQL code is then executed in the database.
Answers # PHP filters are used to validate and sanitize external input. The PHP filter
extension has many of the functions needed for checking user input, and is designed to
make data validation easier and quicker.
Answers # Definition and Usage. The stripslashes() function removes backslashes added
by the addslashes() function. This function can be used to clean up data retrieved from a
database or from an HTML form.
Answers # isset() function. The isset () function is used to check whether a variable is set
or not. If a variable is already unset with unset() function, it will no longer be set. The
isset() function return false if testing variable contains a NULL value.
Answers # The trim() function removes whitespace and other predefined characters
from both sides of a string.
rtrim() – Removes whitespace or other predefined characters from the right side of a
string.
Answers # The die() function prints a message and exits the current script. This function
is an alias of the exit() function.
Answers # You can also convert between strings and arrays by using the PHP implode
and explode functions: implode implodes an array to a string, and explode explodes a
string into an array.
Answers # When using the PCRE functions, it is required that the pattern is enclosed by
delimiters. A delimiter can be any non-alphanumeric, non-backslash, non-whitespace
character. Often used delimiters are forward slashes (/), hash signs (#) and tildes (~).
Scalar type declarations – Scalar type declarations come in two flavors. One is
coercive and the other one is strict.
Return type declarations
Null coalescing operator
Spaceship operator
Constant arrays using define()
Anonymous classes
Unicode codepoint escape syntax
Closure::call()
Answers # A constant is an identifier (name) for a simple value. The value cannot be
changed during the script. A valid constant name starts with a letter or underscore (no $
sign before the constant name).
Answers # In PHP when you output something (do an echo or print) if has to send the
HTTP headers at that time. If you turn on output buffering you can output in the script
but PHP doesn’t have to send the headers until the buffer is flushed. This will turn
output buffering out without the need to call ob_start().
Answers # “Getters” and “Setters” are object methods that allow you to control access to
a certain class variables / properties. Sometimes, these functions are referred to as
“mutator methods”. A “getter” allows to you to retrieve or “get” a given property. A
“setter” allows you to “set” the value of a given property.
Answers # PHP provides a number of ‘magic’ methods that allow you to do some pretty
neat tricks in object oriented programming. These methods, identified by a two
underscore prefix (__), function as interceptors that are automatically called when
certain conditions are met.
__construct()
The __construct() method is by far the most commonly used magic method. This is
where you do any initialization you need when an object is created.
__destruct()
The __destruct() method is called when the object is destroyed. It accepts no arguments
and is commonly used to perform any cleanup operations such as closing a database
connection.
__get()
The __get() method is called when code attempts to access a property that is not
accessible. It accepts one argument, which is the name of the property. It should return
a value, which will be treated as the value of the property.
__set()
The __set() method is called when code attempts to change the value a property that is
not accessible. It accepts two arguments, which are the name of the property and the
value.
__isset()
The __isset() method is called when code calls isset() on a property that is not
accessible. It accepts one argument, which is the name of the property. It should return
a Boolean value representing the existence of a value.
__unset()
The __unset() method is called when code attempts to unset() a property that is not
accessible. It accepts one argument, which is the name of the property.
__toString()
The __toString() method is called when code attempts to treat an object like a string. It
accepts no arguments and should return a string.
__set_state()
The static __set_state() method is called when the var_export() function is called on
our object.
__clone()
The __clone() method can be used to solve this problem. It is called on the copy of a
cloned object after cloning takes place.
__sleep()
The __sleep() method is called when the serialize() function is called on the object. It
accepts no arguments and should return an array of all properties that should be
serialized.
__wakeup()
The __wakeup() method is called when the unserialize() function is called on the stored
object. It accepts no arguments and does not need to return anything. Use it to
reestablish any database connection.
__call()
The __call() is called when code attempts to call inaccessible or nonexistent methods. It
accepts two arguments: the name of the called method and an array of arguments.
__callStatic()
The __callStatic() (available as of PHP version 5.3) is identical to __call() except that it
is called when code attempts to call inaccessible or nonexistent methods in a static
context.
__invoke()
The __invoke() is called when code tries to use the object as a function. Any arguments
defined in this method will be used as the function arguments.
__autoload()
This is not a magic method, but it is still very useful. The __autoload() function is
automatically called when a class that doesn’t exist is referenced.
Coding compiler hope that these 136 PHP interview questions and answers for
freshers and 1 2 3 4 5 years experienced professionals will help you to crack your next
PHP job interview. If you know any other PHP technical interview questions,
please write in below comment box, these PHP questions will be helpful for fellow PHP
professionals.
Leave a Reply
Your email address will not be published. Required fields are marked *
COMMENT
NAME *
EMAIL *
WEBSITE
Post Comment
Post navigation
PREVIOUS Previous post:Kubernetes Interview Questions And Answers 2018
NEXT Next post:ASP.NET Interview Questions And Answers For Experienced
Search for:SEARCH
RECENT POSTS
Anaplan Interview Questions And Answers 2018
60 Java Multiple Choice Questions And Answers 2018
Tableau Multiple Choice Questions And Answers
Python Coding Interview Questions And Answers
CSS3 Interview Questions And Answers For Experienced
ARCHIVES
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
CATEGORIES
Abinitio Interview Questions
Actimize Interview Questions
Alteryx Interview Questions
Anaplan Interview Questions
Android Interview Questions
AngularJS Interview Questions
Animation Interview Questions
Ansible Interview Questions
AnthillPro Interview Questions
Apigee Interview Qestions
Appian Interview Questions
ASP.NET Interview Questions
Automation Anywhere Interview Questions
AWS Interview Questions
Blue Prism Interview Questions
C Programming
CEH Interview Questions
Chef Interview Questions
CRM Interview Questions
CSS3 Interview Questions
CyberArk Interview Questions
DB2 Interview Questions
Drools Interview Questions
Featured
Hibernate Interview Questions
Informatica Interview Questions
Informatica MDM Interview Questions
Interview Questions
Java Interview Questions
Java Programming
Javascript Interview Questions
Jenkins Interview Questions
JSON Interview Questions
Kibana Interview Questions
Kubernetes
Kubernetes Interview Questions
Linux
Linux Interview Questions
Machine Learning
Mulesoft Interview Questions
Nagios Interview Questions
NET Interview Questions
Oracle Performance Tuning Interview Questions
Pega Interview Questions
PeopleSoft Interview Questions
PHP Interview Questions
Programming
Puppet Interview Questions
Python
Python Interview Questions
Ranorex Interview Questions
Reactjs Interview Questions
Robotic Process Automation
RPA Interview Questions
Salesforce Interview Questions
SAP ABAP Interview Questions
SAP EWM Interview Questions
SAP Interview Questions
SAP SD Interview Questions
SCCM Interview Questions
Selenium Interview Questions
ServiceNow Interview Questions
SQL Interview Questions
SQL Server Interview Questions
SSIS Interview Questions
SSRS Interview Questions
Tableau Interview Questions
Talend Interview Questions
Technical
Testing Interview Questions
UI Developer Interview Questions
UiPath Interview Questions
Visualforce Interview Questions
RECENT COMMENTS
Madhavi on Advanced Automation Anywhere Interview Questions For
Experienced 2018
Coding Compiler on Advanced RPA Interview Questions For Experienced
Coding Compiler on Advanced RPA Interview Questions For Experienced
Coding Compiler on Advanced RPA Interview Questions For Experienced
Coding Compiler on Advanced RPA Interview Questions For Experienced
Programming Tutorials | Interview Questions | Coding Compiler Proudly powered
by WordPress
Skip to content
Answer # php is called hypertext pre-processor as its libraries are already compiled.
When any person request for any php page in the address bar of the browser that
request is first sent to the server then server interpret php files and return back response
in form of Html.
Answer # HTML is a language used to describe to a browser how to display text and
other objects in a browser window. It is not a programming language. HTML works on a
client computer (the system on which the page is being viewed). PHP is a scripting
language, and can be used to create web pages written in HTML.
Answer # PHP 5 is a server scripting language, and a powerful tool for making dynamic
and interactive Web pages. PHP is a widely-used, free, and efficient alternative to
competitors such as Microsoft’s ASP.
Answer # PHP is mainly focused on server-side scripting, so you can do anything any
other CGI program can do, such as collect form data, generate dynamic page content, or
send and receive cookies. But PHP can do much more. There are three main areas where
PHP scripts are used. Server-side scripting.
Question # 7) What is the difference between PHP and Javascript?
Answer # While JS is used for client side scripting (except in node.js) and PHP is used
for server side scripting. Simply, JavaScript codes are executed by your web browser,
like the catchy animations or simple calculations . Your browser does all the processing.
While PHP runs on the server, where your webpage is stored.
Answer # HTML is a language used to describe to a browser how to display text and
other objects in a browser window. It is not a programming language. HTML works on a
client computer (the system on which the page is being viewed). PHP is a scripting
language, and can be used to create web pages written in HTML.
Answer # PHP is a language that’s made for the web. You can make GTK and CLI
applications with PHP, but it’s mainly used for websites. Python is used for a lot of stuff
like websites, webservers, game frameworks, desktop and CLI application, IDEs and a
lot more. There’s also a huge difference in the syntax.
Answer # The PHP software works with the web server, which is the software that
delivers web pages to the world. You request a file, the web server happens to be
running PHP, and it sends HTML back to the browser, thanks to the programming in
PHP.
Answer # PHP is commonly written in-line in the same files as HTML and Javascript,
PHP is a server-side language. Javascript is a client-side language. The main difference
here is not PHP vs. JavaScript. It’s Client vs. Server. You can’t do server stuff on the
client, and you can’t do all the Client stuff on the Server.
Question # 17) What is the main difference between asp net and PHP?
Answer # the session id is sent to the user when his session is created. it is stored in a
cookie (called, by default, PHPSESSID ) that cookie is sent by the browser to the server
with each request. the server (PHP) uses that cookie, containing the session_id, to know
which file corresponds to that user.
Answer # If you want to explicitly end a user’s and delete their data without them having
to close their browser, you need to clear the $_SESSION array, then use the
session_destroy() function. Session_destroy() removes all session data stored on your
hard disk, leaving you with a clean slate.
Question # 20) What are the advantages of PHP mysql?
Answer # It is a stable, reliable and powerful solution with advanced features like the
following:
Data Security
On-Demand Scalability
High Performance
Round-the-clock Uptime
Comprehensive Transactional Support
Complete Workflow Control
Reduced Total Cost of Ownership
The Flexibility of Open Source
Answer # PHP and Java are both very similar when it comes to the benefits provided,
but they are both very different. PHP is a server side scripting language, while Java is a
client side choice. When you use PHP code, you will execute it in the actual server, while
Java will be executed on your client’s computer.
Step 1: download the files. Download the latest PHP 5 ZIP package from
www.php.net/downloads.php
Answer # This can be used to persist state information between page requests. Session
IDs are normally sent to the browser via session cookies and the ID is used to retrieve
existing session data. PHP will populate the $_SESSION superglobal with any session
data after the session has started.
Answer # This is the one. The session will last for 1440 seconds (24 minutes).
Answer # PHP is the most popular scripting language for web development. It is free,
open source and server-side (the code is executed on the server). MySQL is a Relational
Database Management System (RDBMS) that uses Structured Query Language (SQL).
Answer # It may surprise you to learn that JavaScript and jQuery are actually the same
thing. In a nutshell, jQuery is a set of JavaScript libraries that have been designed
specifically to simplify HTML document traversing, animation, event handling, and Ajax
interactions.
PHP Interview Questions And Answers
Question # 27) What is the difference between interpreted and compiled languages?
Answer # Java (interpreted) and C (or C++) (compiled) might have been a better
example. Basically, compiled code can be executed directly by the computer’s CPU. The
code of interpreted languages however must be translated at run-time from any format
to CPU machine instructions. This translation is done by an interpreter.
Answer # A cookie is often used to identify a user. A cookie is a small file that the server
embeds on the user’s computer. Each time the same computer requests a page with a
browser, it will send the cookie too. With PHP, you can both create and retrieve cookie
values.
Answer # A session is a global variable stored on the server. Each session is assigned a
unique id which is used to retrieve stored values. Sessions have the capacity to store
relatively large data compared to cookies. The session values are automatically deleted
when the browser is closed.
Question # 31) What is in PHP 7?
Answer # Designed and refactored for today’s workloads, PHP 7 is the ultimate choice
for web developers today. Get started now. Faster performance, less resources, and cool
new features like scalar type declarations, the Spaceship Operator, anonymous classes,
and more.
Answer # In the PHP world, apparantly uninitialized variables have the Null value, and
is set on such a variable returns FALSE.
Answer # Traits are a mechanism for code reuse in single inheritance languages such as
PHP. A Trait is intended to reduce some limitations of single inheritance by enabling a
developer to reuse sets of methods freely in several independent classes living in
different class hierarchies.
Answer # The is_null () function is used to test whether a variable is NULL or not.
*Mixed : Mixed indicates that a parameter may accept multiple (but not necessarily all)
types. Returns TRUE if var_name is null, FALSE otherwise.
Answer # An empty string is a value, but is just empty. Null is special to a database. Null
has no bounds, it can be used for string , integer , date , etc. fields in a database. NULL
isn’t allocated any memory, the string with NUll value is just a pointer which is pointing
to nowhere in memory.
Answer # PHP 5 introduces the final keyword, which prevents child classes from
overriding a method by prefixing the definition with final. If the class itself is being
defined final then it cannot be extended.
Answer # PHP callback are functions that may be called dynamically by PHP. They are
used by native functions such as array_map, usort, preg_replace_callback, etc. Here is a
reminder of the various ways to create a callback function in PHP, and use it with the
native functions.
Answer # To sum up, a lambda function is an anonymous PHP function that can be
stored in a variable and passed as an argument to other functions or methods. A closure
is a lambda function that is aware of its surrounding context.
Answer # Overloading is defining functions that have similar signatures, yet have
different parameters. Overriding is only pertinent to derived classes, where the parent
class has defined a method and the derived class wishes to override that method. In
PHP, you can only overload methods using the magic method __call.
Answer # PHP Booleans. A Boolean value is one that is in either of two states. They are
known as True or False values, in programming. True is usually given a value of 1, and
False is given a value of zero.
Answer # prinf : It is a function which takes atleast one string and format style and
returns length of output string. print_r() is used for printing the array in human
readable format. they both are language constructs. echo returns void and print returns
1.
Answer # Anonymous functions, also known as closures, allow the creation of functions
which have no specified name. They are most useful as the value of callback parameters,
but they have many other uses. Anonymous functions are implemented using the
Closure class.
Answer # (PHP 4, PHP 5, PHP 7) return returns program control to the calling module.
Execution resumes at the expression following the called module’s invocation. If called
from within a function, the return statement immediately ends execution of the current
function, and returns its argument as the value of the function call.
Answer # The die() function prints a message and exits the current script. This function
is an alias of the exit() function.
Answer # PHP Arrays – An array is a data structure that stores one or more similar type
of values in a single value. For example if you want to store 100 numbers then instead of
defining 100 variables its easy to define an array of 100 length.
Answer # Similiar to the HTML comment, the multi-line PHP comment can be used to
comment out large blocks of code or writing multiple line comments. The multiple line
PHP comment begins with ” /* ” and ends with ” */ “.
Answer # They are both variables. But $message is a variable with a fixed name. $
$message is a variable who’s name is stored in $message. For example, if $message
contains “var”, $$message is the same as $var.
Question # 54) What is the difference between require and include in PHP?
Answer # Require and include functions does the same task i.e. includes and evaluates
specified file, but the difference is require will cause a fatal error when the specified file
location is invalid or for any error where as include will generate a warning and continue
the code execution.
1. Warning errors
2. Notice errors
3. Fatal errors
4. Parse errors
Answer #
Answer # The include_once statement includes and evaluates the specified file during
the execution of the script. This is a behavior similar to the include statement, with the
only difference being that if the code from a file has already been included, it will not be
included again, and include_once returns TRUE .
Answer # With PHP 5 came a new object oriented way of dealing with errors. Exception
handling is used to change the normal flow of the code execution if a specified error
(exceptional) condition occurs. This condition is called an exception.
Answer # GET can’t be used to send binary data, like images or word documents, to the
server. The data sent by GET method can be accessed using QUERY_STRING
environment variable. The PHP provides $_GET associative array to access all the sent
information using GET method. The POST method transfers information via HTTP
headers.
Answer # When the user fills out the form above and clicks the submit button, the form
data is sent for processing to a PHP file named “welcome.php”. The form data is sent
with the HTTP POST method. To display the submitted data you could simply echo all
the variables.
Question # 61) What is the difference between require_once and require in PHP?
Answer # require() includes and evaluates a specific file, while require_once() does that
only if it has not been included before (on the same page). So, require_once() is
recommended to use when you want to include a file where you have a lot of functions
for example.
Answer # The die() function prints a message and exits the current script. This function
is an alias of the exit() function.
Answer # To run a debugging session: Start the ide and open the file that contains the
source code that you want to debug. Set a breakpoint at each line where you want the
debugger to pause. To set a breakpoint, place the cursor at the beginning of a line and
press Ctrl-F8/⌘-F8 or choose Debug > Toggle Line Breakpoint.
Answer # Chrome Logger is a Google Chrome extension for debugging server side
applications in the Chrome console. Most languages include their own logging
capabilities, but sometimes it is easier to see your logs right in the browser. Chrome
Logger used to be known as ChromePHP.
urldecode(string) – This PHP function id decodes any encoded value in the given string.
Answer #
Answer # Database Storage Capacity. MySQL is limited by the largest file size that the
operating system you run it on can handle (between 4Gb and 256Tb depending on the
O/S). With the innoDB table format you can even span multiple files with one table
allowing for tables in the database of up to 64Tb.
Answer # In InnoDB, with a limit on table size of 64 terabytes and a MySQL row-size
limit of 65,535 there can be 1,073,741,824 rows. That would be minimum number of
records utilizing maximum row-size limit. However, more records can be added if the
row size is smaller.
Answer # MySQL 5.0 Column Count Limits: There is a hard limit of 4096 columns per
table, but the effective maximum may be less for a given table. The exact limit depends
on several interacting factors. Every table (regardless of storage engine) has a maximum
row size of 65,535 bytes.
Answer # Values in VARCHAR columns are variable-length strings. The length can be
specified as a value from 0 to 65,535. The effective maximum length of a VARCHAR is
subject to the maximum row size (65,535 bytes, which is shared among all columns) and
the character set used.
PHP Programming Interview Questions
Answer # n defines the string length and can be a value from 1 through 8,000. max
indicates that the maximum storage size is 2^31-1 bytes (2 GB). The storage size is the
actual length of the data entered + 2 bytes. The ISO synonyms for varchar are
charvarying or charactervarying.
Answer # The MySQL trigger is a database object that is associated with a table. It will
be activated when a defined action is executed for the table. The trigger can be executed
when you run one of the following MySQL statements on the table: INSERT, UPDATE
and DELETE and it can be invoked before or after the event.
Answer # In Nvarchar “n” defines the string length and can be a value from 1 through
4,000. max indicates that the maximum storage size is 2^31-1 bytes (2 GB). The storage
size, in bytes, is two times the actual length of data entered + 2 bytes. The ISO synonyms
for nvarchar are national char varying and national character varying.
Answer # delimiter is the marker for the end of each command you send to the mysql
command line client. delimiter is not only related to triggers, but defining triggers and
stored procedures is one strong use case as you wish them to contain semicolons (;)
which are otherwise the default delimiter.
Answer # All stored programs (procedures, functions, triggers, and events) and views
can have a DEFINER attribute that names a MySQL account. If the DEFINER attribute
is omitted from a stored program or view definition, the default account is the user who
creates the object.
Answer # The benefits of using stored procedures in SQL Server rather than application
code stored locally on client computers include: They allow modular programming.
They allow faster execution. They can reduce network traffic.
Answer # Limit Data Selections From a MySQL Database. MySQL provides a LIMIT
clause that is used to specify the number of records to return. The LIMIT clause makes it
easy to code multi page results or pagination with SQL, and is very useful on large
tables. Returning a large number of records can impact on performance.
PHP Interview Questions And Answers
Answer # The DUAL table is a special one-row, one-column table present by default in
Oracle and other database installations. In Oracle, the table has a single VARCHAR2(1)
column called DUMMY that has a value of ‘X’. It is suitable for use in selecting a pseudo
column such as SYSDATE or USER.
Answer # The MySQL INNER JOIN clause matches rows in one table with rows in other
tables and allows you to query rows that contain columns from both tables. The INNER
JOIN clause is an optional part of the SELECT statement.
Question # 87) What is the difference between an inner and outer join?
Answer # An inner join will only select records where the joined keys are in both
specified tables. A left outer join will select all records from the first table, and any
records in the second table that match the joined keys.
Answer # Both MySQL and PostgreSQL support a really cool feature called OFFSET that
is usually used with a LIMIT clause. The LIMIT clause is used to limit the number of
results returned in a SQL statement.
Answer # soundex and metaphone can be used to find strings that sound similar when
pronounced out loud.
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.
Answer # The parse_ini_file() function parses a configuration (ini) file and returns the
settings.
Answer # Traits are a mechanism for code reuse in single inheritance languages such as
PHP. A Trait is intended to reduce some limitations of single inheritance by enabling a
developer to reuse sets of methods freely in several independent classes living in
different class hierarchies.
Answer # The main difference is that, with interfaces, you must define the actual
implementation of each method within each class that implements said interface, so you
can have many classes implement the same interface but with different behavior, while
traits are just chunks of code injected in a class.
Answer #
<?php
trait ezcReflectionReturnInfo {
use ezcReflectionReturnInfo;
/* … */
/* … */
?>
Question # 97) Is there an easy way to delete an element from a PHP array?
Answer # If we want to delete just one array element you can use unset() method or
alternative array_splice() method. Also if you have the value and don’t know the key to
delete the element you can use array_search() method to get the key.
Question # 98) Can you explain, when to use If-else if-else over switch statements?
Question # 99) When do you use define() and when do you use const. What are the
main differences between those two?
Answer # PHP 5.3 there are two ways to define constants: Either using the const
keyword or using the define() function:
const FOO = ‘BAR’;
define(‘FOO’, ‘BAR’);
The fundamental difference between those two ways is that const defines constants at
compile time, whereas define() defines them at runtime. As const are language
constructs and defined at compile time they are a bit faster than define().
Answer # In PHP self keyword is used to access static properties and methods.
Answer # It is the way to reference an instance of a class from within itself, the same as
many other object-oriented languages. $this refers to the class you are in. In PHP, the
pseudo-variable $this is available when a method is called from within an object
context.
Answer # Use $this to refer to the current object. Use self to refer to the current class.
Answer # There are different web servers available for different technologies.
Answer # The Apache HTTP server and NGINX are the two most popular open source
web servers in the world today. The Apache web servers have been in use since 1995.
Apache powers more websites than any other product. Because the open-source Apache
web server has been available for so many years, and has so many users, lots of modules
have been written to expand its functionality.
But Apache slows down under heavy load, because of the need to spawn new processes,
thus consuming more computer memory. It also creates new threads that must compete
with others for access to memory and CPU. Apache will also refuse new connections
when traffic reaches the limit of processes configured by the administrator.
Nginx is an open source web server written to address some of the performance and
scalability issues associated with Apache. The product is open source and free, but
Nginx offers support if you buy its Nginx Plus version. Nginx is indeed event-based.
They call their architecture “event-driven and asynchronous”. Apache relies on
processes and threads.
Answer # .htaccess is a configuration file for use on web servers running the Apache
Web Server software. When a .htaccess file is placed in a directory which is in turn
‘loaded via the Apache Web Server’, then the .htaccess file is detected and executed by
the Apache Web Server software.
URL redirecting
Managing error pages
Password Protection
Visitor blocking facilities by IP address
Setting Config variable and Environment variable
Answer # Using this below code, we can redirect a URL from http to https
RewriteEngine on
RewriteCond %{HTTPS} off
Question # 110) How to redirect https to http URL and vice versa in .htaccess?
Answer # Using this below code, we can redirect a URL from http to https
RewriteEngine On
RewriteCond %{HTTPS} on
Answer # Artisan is the name of the command-line interface included with Laravel. It
provides a number of helpful commands for your use while developing your application.
It is driven by the powerful Symfony Console component.
$a === $b │ Identical │ TRUE if $a is equal to $b, and they are of the same type.
Answers: $i = 012;
echo $i / 2;
Explanation: You might think that output for the above code is 6 right. That’s the wrong
answer. But the correct output should be 5. The zero indicates at the beginning of a
number as an octal number in PHP, so the number 012 evaluates to the decimal number
10 instead to decimal 12. Then the output should be 5.
Answers # SQL injection (or a SQL injection attack) occurs when a user provides SQL
code as user input for a Web page, and the SQL code is then executed in the database.
Answers # PHP filters are used to validate and sanitize external input. The PHP filter
extension has many of the functions needed for checking user input, and is designed to
make data validation easier and quicker.
Answers # Definition and Usage. The stripslashes() function removes backslashes added
by the addslashes() function. This function can be used to clean up data retrieved from a
database or from an HTML form.
Answers # isset() function. The isset () function is used to check whether a variable is set
or not. If a variable is already unset with unset() function, it will no longer be set. The
isset() function return false if testing variable contains a NULL value.
Answers # The trim() function removes whitespace and other predefined characters
from both sides of a string.
rtrim() – Removes whitespace or other predefined characters from the right side of a
string.
Answers # The die() function prints a message and exits the current script. This function
is an alias of the exit() function.
Answers # You can also convert between strings and arrays by using the PHP implode
and explode functions: implode implodes an array to a string, and explode explodes a
string into an array.
Answers # When using the PCRE functions, it is required that the pattern is enclosed by
delimiters. A delimiter can be any non-alphanumeric, non-backslash, non-whitespace
character. Often used delimiters are forward slashes (/), hash signs (#) and tildes (~).
Scalar type declarations – Scalar type declarations come in two flavors. One is
coercive and the other one is strict.
Return type declarations
Null coalescing operator
Spaceship operator
Constant arrays using define()
Anonymous classes
Unicode codepoint escape syntax
Closure::call()
Answers # A constant is an identifier (name) for a simple value. The value cannot be
changed during the script. A valid constant name starts with a letter or underscore (no $
sign before the constant name).
Answers # In PHP when you output something (do an echo or print) if has to send the
HTTP headers at that time. If you turn on output buffering you can output in the script
but PHP doesn’t have to send the headers until the buffer is flushed. This will turn
output buffering out without the need to call ob_start().
Answers # “Getters” and “Setters” are object methods that allow you to control access to
a certain class variables / properties. Sometimes, these functions are referred to as
“mutator methods”. A “getter” allows to you to retrieve or “get” a given property. A
“setter” allows you to “set” the value of a given property.
Answers # PHP provides a number of ‘magic’ methods that allow you to do some pretty
neat tricks in object oriented programming. These methods, identified by a two
underscore prefix (__), function as interceptors that are automatically called when
certain conditions are met.
__construct()
The __construct() method is by far the most commonly used magic method. This is
where you do any initialization you need when an object is created.
__destruct()
The __destruct() method is called when the object is destroyed. It accepts no arguments
and is commonly used to perform any cleanup operations such as closing a database
connection.
__get()
The __get() method is called when code attempts to access a property that is not
accessible. It accepts one argument, which is the name of the property. It should return
a value, which will be treated as the value of the property.
__set()
The __set() method is called when code attempts to change the value a property that is
not accessible. It accepts two arguments, which are the name of the property and the
value.
__isset()
The __isset() method is called when code calls isset() on a property that is not
accessible. It accepts one argument, which is the name of the property. It should return
a Boolean value representing the existence of a value.
__unset()
The __unset() method is called when code attempts to unset() a property that is not
accessible. It accepts one argument, which is the name of the property.
__toString()
The __toString() method is called when code attempts to treat an object like a string. It
accepts no arguments and should return a string.
__set_state()
The static __set_state() method is called when the var_export() function is called on
our object.
__clone()
The __clone() method can be used to solve this problem. It is called on the copy of a
cloned object after cloning takes place.
__sleep()
The __sleep() method is called when the serialize() function is called on the object. It
accepts no arguments and should return an array of all properties that should be
serialized.
__wakeup()
The __wakeup() method is called when the unserialize() function is called on the stored
object. It accepts no arguments and does not need to return anything. Use it to
reestablish any database connection.
__call()
The __call() is called when code attempts to call inaccessible or nonexistent methods. It
accepts two arguments: the name of the called method and an array of arguments.
__callStatic()
The __callStatic() (available as of PHP version 5.3) is identical to __call() except that it
is called when code attempts to call inaccessible or nonexistent methods in a static
context.
__invoke()
The __invoke() is called when code tries to use the object as a function. Any arguments
defined in this method will be used as the function arguments.
__autoload()
This is not a magic method, but it is still very useful. The __autoload() function is
automatically called when a class that doesn’t exist is referenced.
Coding compiler hope that these 136 PHP interview questions and answers for
freshers and 1 2 3 4 5 years experienced professionals will help you to crack your next
PHP job interview. If you know any other PHP technical interview questions,
please write in below comment box, these PHP questions will be helpful for fellow PHP
professionals.
Leave a Reply
Your email address will not be published. Required fields are marked *
COMMENT
NAME *
EMAIL *
WEBSITE
Post Comment
Post navigation
PREVIOUS Previous post:Kubernetes Interview Questions And Answers 2018
NEXT Next post:ASP.NET Interview Questions And Answers For Experienced
Search for:SEARCH
RECENT POSTS
Anaplan Interview Questions And Answers 2018
60 Java Multiple Choice Questions And Answers 2018
Tableau Multiple Choice Questions And Answers
Python Coding Interview Questions And Answers
CSS3 Interview Questions And Answers For Experienced
ARCHIVES
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
CATEGORIES
Abinitio Interview Questions
Actimize Interview Questions
Alteryx Interview Questions
Anaplan Interview Questions
Android Interview Questions
AngularJS Interview Questions
Animation Interview Questions
Ansible Interview Questions
AnthillPro Interview Questions
Apigee Interview Qestions
Appian Interview Questions
ASP.NET Interview Questions
Automation Anywhere Interview Questions
AWS Interview Questions
Blue Prism Interview Questions
C Programming
CEH Interview Questions
Chef Interview Questions
CRM Interview Questions
CSS3 Interview Questions
CyberArk Interview Questions
DB2 Interview Questions
Drools Interview Questions
Featured
Hibernate Interview Questions
Informatica Interview Questions
Informatica MDM Interview Questions
Interview Questions
Java Interview Questions
Java Programming
Javascript Interview Questions
Jenkins Interview Questions
JSON Interview Questions
Kibana Interview Questions
Kubernetes
Kubernetes Interview Questions
Linux
Linux Interview Questions
Machine Learning
Mulesoft Interview Questions
Nagios Interview Questions
NET Interview Questions
Oracle Performance Tuning Interview Questions
Pega Interview Questions
PeopleSoft Interview Questions
PHP Interview Questions
Programming
Puppet Interview Questions
Python
Python Interview Questions
Ranorex Interview Questions
Reactjs Interview Questions
Robotic Process Automation
RPA Interview Questions
Salesforce Interview Questions
SAP ABAP Interview Questions
SAP EWM Interview Questions
SAP Interview Questions
SAP SD Interview Questions
SCCM Interview Questions
Selenium Interview Questions
ServiceNow Interview Questions
SQL Interview Questions
SQL Server Interview Questions
SSIS Interview Questions
SSRS Interview Questions
Tableau Interview Questions
Talend Interview Questions
Technical
Testing Interview Questions
UI Developer Interview Questions
UiPath Interview Questions
Visualforce Interview Questions
RECENT COMMENTS
Madhavi on Advanced Automation Anywhere Interview Questions For
Experienced 2018
Coding Compiler on Advanced RPA Interview Questions For Experienced
Coding Compiler on Advanced RPA Interview Questions For Experienced
Coding Compiler on Advanced RPA Interview Questions For Experienced
Coding Compiler on Advanced RPA Interview Questions For Experienced
Programming Tutorials | Interview Questions | Coding Compiler Proudly powered
by WordPress
PHP interview
questions and answers
for experienced
In this section we are giving you some frequently asked PHP Interview
Questions for experienced developers who have minimum 6 months of
relevant experience in PHP based web developement. PHP programming
knowledge in not only the measure of your web development experience, so
that you must have good knowledge in its related technologies like CSS,
HTML, JavaScript, Jquery etc and it will be a plus point if you have knowledge
in Frameworks/ Tools like AngularJs, BootStrap, Linux and its commads ,
experience in deploying a website in a live server and good communication
skill english.Before start reading the questions. It will be good to go through
the php questions for freshers
1. How to collect IP address from an HTTP request ?
$_SERVER['REMOTE_ADDR'];
2. How to collect IP address of the Web server in php ?
$_SERVER['SERVER_ADDR'];
3. How to enable error reporting ?
error_reporting(E_ALL);
4. What is $_GLOBAL ?
It is an associative array which containing references to all variables currently
defined in the global scope of the script.
5. What is .htaccess file ?
.htaccess is a configuration file used to alter the default behavior of a
Apache web server software. Most common usage is to redirect the http request
to some URLs based on some conditions. For example, we can hide the .html
or .php extensions of the URLs to make it SEO friendly
6. How to print structured information about a available in PHP ?
var_dump — This function displays structured information about one or more
expressions that includes its value and type. Objects and arrays are explored
recursively with values indented to show structure.
Usage var_dump($a);
7. What is the difference between var_dump and print_r ?
var_dump will display all the information of a variable including keys values and
types while print_r display the keys and values only in a human readable format.
8. What is automatic type conversion ?
In php we can declare variables without specifying its type, php it do that process
automatically since PHP is a loosely types language.
For example :
<?php //$count is a string variable $count = "5"; //$count is an int
variable $count = 5; ?>
We can also set the max_execution_time for all the scripts in a website by the
following code in .htaccess file
<IfModule mod_php5.c> php_value max_execution_time 300 </IfModule>
But, we must try to optimize the php script to avoid this kind of situations as a
part good user experience.
12. How to avoid email sent through php getting into spam folder?
There's no special method of keeping your emails from being identified as spam.
However we can consider some points that cause this problem. Let me explain
few common reasons.
1. sending mail using the `mail` function with minimum parameters
We must use all possible mail headers like `MIME-version`, `Content-type`,
`reply address`, `from address` etc in order to avoid this situation
2. Not using a proper SMTP mail script like PHPmailer or SwiftMailer with an
actual e-mail credentials including username, password etc
If we are able to send e-mail from an actual e-mail account using an SMTP
mailer script with username and password, then we can avoid
If you’re on a shared web server, consider buying a unique IP address for
yourself, because others using your IP may have gotten your IP blacklisted for
spam. Do not send more than 250 emails to each provider per hour.
Give your users unsubscribe link and view in browser link, if they cannot see the
email properly they will mark you as spam, if they no longer want emails for you
they will mark you as spam.
How can we prevent SQL injection in PHP?
Most popular way is, use prepared statements and parameterized queries. These
are SQL statements that are sent to and parsed by the database server
separately from any parameters. This way it is impossible for an attacker to inject
malicious SQL.
You basically have two options to achieve this:
1. Using PDO (for any supported database driver):
2. $stmt = $pdo>prepare('SELECT * FROM employees WHERE name =
:name');
3. $stmt>execute(array('name' => $name));
4. foreach ($stmt as $row) {
5. // do something with $row
8. $stmt>execute();
9. $result = $stmt>get_result();
10. while ($row = $result>fetch_assoc()) {
11. // do something with $row
header('ContentType: application/json');
echo json_encode($data);