Top PHP Frameworks and CMS List

PHP Frameworks and CMS Interview Questions: PHP stands for PHP: Hypertext Preprocessor. It is widely general purpose open source programming language specially designed for creating dynamic web applications. Read Best Interview questions on PHP Frameworks and CMS.

  • What are anonymous classes in PHP7.
    Php 7

    Posted By: Annie

    Anonymous Class in PHP is new way of creating object without the need to name them. Anonymous classes are created and initiated at same time.

    Example of an Anonymous Class in PHP

    $object =new class('argument'){
    
    public $property;
    
    public function __construct($argument){
    
    	$this->property=$argument;
    
    }
    
    }
    

  • What is Coercive mode in PHP?
    Php 7

    Posted By: Gene

    Coercive mode in PHP is the default mode of Scalar type declarations (Feature introduced in PHP 7).

  • What is Strict mode in PHP?
    Php 7

    Posted By: Prashant

    Strict mode is new feature in PHP in which variable declaration is required before using it.

  • What are Array constants?
    Php 7

    Posted By: Dana

    In PHP 5.6 or we can define constants as a scalar expression. We can define an array constant using the define keyword.

    Array Constant Example in PHP

     define('fruits', [
          'apple',
          'mango',
          'banana'
       ]);
     print(fruits[2]); // outputs banana
    

  • Explain Spaceship Operator?
    Php 7

    Posted By: Marcel

    Spaceship operator also is known as (combined comparison operator) is a new operator introduced in PHP 7. This operator is denoted by "<=>". This single operator can perform greater than, less than, and equal comparison between two operands. Its behavior is similar like strcmp() or version_compare() functions and can be used with integers, floats, strings, arrays, objects, etc.

  • What is use of random_bytes() in PHP?
    Php 7

    Posted By: EvgeniaAnd

    random_bytes() function in PHP is used to generate cryptographically secure pseudo-random bytes.

    Syntax:

    String random_bytes ( int $length )
    

    Usage

    $length = random_bytes('4'); 
      
    //Print the reult and convert by binaryhexa 
    var_dump(bin2hex($length)); 
    
    

  • List some features of PHP that are deprecated in PHP 7?
    Php 7

    Posted By: Manjiri Kulkarni

    PHP Features that are deprecated in PHP 7 are.

    • PHP 4 style constructors
    • Static calls to non-static methods
    • password_hash() salt option
    • capture_session_meta SSL context option

  • What is use of set_exception_handler() in PHP?
    Php 7

    Posted By: Anonymous

    set_exception_handler() is a library function in PHP. It is used to set the default exception handler if an exception is not caught within a try/catch block in PHP.exception_handler stop the execution of script.

  • List some extensions have been removed from PHP 7?
    Php 7

    Posted By: Sol

    Following extensions are removed from PHP and are no longer in use

    • ereg
    • mssql
    • mysql
    • sybase_ct

    Read More from https://www.php.net

  • What is mvc in PHP?
    Php

    Posted By: bookermontenegro

    MVC is a design pattern for creating applications that separate Business logic (Controller) and Application data (Models) from the USER interface (View). MVC is an acronym of Model, View Controller.

  • Write a program to upload files using curl
    Php

    Posted By: Abercormlen

  • What is name of max execution time constant in php?
    Php

    Posted By: Winfred

    max_execution_time is of the constant that is used to increase the execution time of a script in PHP.

  • What is difference between echo and print in PHP?
    Php

    Posted By: Vincent

     There are small difference between Echo and Print in PHP. 

     These are - 

    1. Echo has no return value while Print has a return value of 1.
    2. Echo is marginally faster in comparison of Print.
    3. Echo can output one are more strings while Print can output only 1 string.
    4. Echo is a language constructor while Print is a function.

  • What is HTML DOM?
    Php

    Posted By: Oran

    DOM (Document Object Model) is a Object Model for HTML. The Document Object Model (DOM) defines the logical structure of documents and the way a document is accessed and manipulated.

  • Explian the difference between cookie and session?
    Php

    Posted By: Akhil Joy

  • How to create cookies via Ajax in PHP?
    Php

    Posted By: Sim

  • What is sql injection? What you do to prevent SQL Injection in PHP?
    Php

    Posted By: Lyman

  • Explain scope levels in PHP.
    Php

    Posted By: Jignesh

    There are 3 different levels of Scopes are available in PHP. They are.

    • Public: Public scopes allow you to access all data and functions of a Class.
    • Private: Private scopes don't allow you to access the private data and functions of a Class.
    • Protected: Protected scopes only allows its derived class to access the Protected data and functions of a Class.

  • Find the longest palindrome in a string
    Php

    Posted By: Bud

  • What is difference between session and cookie?
    Php

    Posted By: Eddierot

    The Major difference between sessions and cookies are - 

    1.  Sessions are stored in Server Side while Cookies are sotred in Client Side.
    2.  Sessions are stored unlimited amount of Data while Cookies are Stored limited amount of Data.
    3.  Sessions are holding multiple variables while Cookies are not holding multiple varibles.
    4.  Sessions are more secure than Cookies.
    5.  Sessions values are not easily accessible While Cookies values are easily accessible.
    6.  Sessions can not disabled by visitor while cookies can disabled by the visitor.

  • How to get IP address of user in PHP
    Php

    Posted By: Jose

    In your code simply use  $_SERVER['REMOTE_ADDR'] to get the IP address of the client or User.

  • What is the full form of PHP?
    Php

    Posted By: Mohammed Vajhullah

    The full form of PHP is Hypertext preprocessor (earlier called personal home page)

  • How to create object of Interface?
    Php

    Posted By: Asbury

  • What is cross site scripting and how it can be prevented?
    Php

    Posted By: Allen

  • Write pyramid structure without using PHP function ?
    Php

    Posted By: Winfield

  • What is difference between XAMPP, WAMP, and LAMP
    Php

    Posted By: Gardner

    The difference among XAMPP, WAMP and LAMP are - 

                      XAMPP                WAMP                     LAMP
    It is a combine Package of Apache, MariaDB,PHP and Perl.It is a combine Package of Apache, MYSQL and PHP. It is a combine Package of Apache MYSQL And PHP.
    It has compatible with all available operating system as Window, OS-X and Linux.It has limited only for windows operating system. It is a open source platform and Compatible with only Linux.

  • Tell me few diffrence between GET & POST
    Php

    Posted By: Faisal alamgir

    Few difference between GET & POST is - 

    GET request remains in browser history while POST Request does not remain in browser history.

    GET is availbale for retrieving data while POST is available for writing/Updating data.

    GET have no side effects while POST have some side effects.

     

  • How to connect MongoDB using PHP?
    Php

    Posted By: Hunter

  • What is default session time in PHP? How to increase It?
    Php

    Posted By: Leon

  • How can you connect a web page data with mysql ?
    Php

    Posted By: Michael

  • Explian the difference between preg_Match and preg_replace?
    Php

    Posted By: luciomontague9

    preg_Match is the pattern, that is used for searching as a string, while preg_replace is the pattern, that contains the string which is used to search the content, which can be the array of string.

     

  • List the HTTP methods avalable in PHP?
    Php

    Posted By: SMK

  • What is Interface? Why we use it?
    Php

    Posted By: Hayden

  • What is difference betwwen PHP 4, 5 and 7?
    Php

    Posted By: B.V.Sravani

  • What is difference between the include(), require(),require_once() functions in PHP?
    Php

    Posted By: Krishna Kushwaha

  • What are design patterns in PHP? Can you list few.
    Php

    Posted By: Enoch

  • What are Super Global variables in PHP?
    Php

    Posted By: Rollin

  • What is Php ini?
    Php

    Posted By: Elvis

  • Code to send a mail with attachment using phpmailer?
    Php

    Posted By: Lambert

  • What is difference between CURL and AJAX?
    Php

    Posted By: Henderson

  • How to set and Get a value in PHP Session.
    Php

    Posted By: Antone

  • What is the usage of link() in PHP?
    Php

    Posted By: Jignesh

  • What's new in PHP7?
    Php 7

    Posted By: Sim

    New features of PHP 7 are  - 

    1. Scalar type declaration
    2. Return type declarations
    3. Null coalescing operator
    4. Spaceship operator
    5. Constant arrays using define
    6. Anonymous classes
    7. Unicode codepoint escape syntax
    8. Closure::call
    9. Filtered unserialize
    10. IntlChar
    11. Expectations
    12. Group use declarations
    13. Generator Return Expressions
    14. Generator delegation
    15. Integer division with intdiv
    16. Session options
    17. preg_replace_callback_array
    18. CSPRNG Functions

  • How to upgrade the version of PHP 5 to PHP 7?
    Php 7

    Posted By: General

  • What is Null Coalesce Operator?
    Php 7

    Posted By: Rubin

    Null Coalesce Operator (??) is introduced in PHP 7. This operator is used as a replacement of isset() along with the ternary operator (?:). The Null Coalesce operator (??) returns the result of its first operand if it exists and is not NULL, or else it will return its second operand.

  • Explain Scalar type declarations in PHP7.
    Php 7

    Posted By: Francis

    Scalar type declarations is a new feature of PHP that is introduced in PHP 7. There are two options of Scalar type declaration are available.

    • Strict
    • Coercive

  • What are pros and cons of using Laravel Framework?
    Laravel

    Posted By: Bharathi

    Pros of Laravel

    1. It uses Blade template engine that helps in speed up compilation tasks and writing cleaner code.
    2. Bundled modularity forces code reusability.
    3. Easy to understand Eloquent ORM.
    4. Outstanding Command Line Interface Artisan.
    5. Clean, clear easily understandable documentation.

    Cons of Laravel

    1. Quite slow because of loading multiple vendors.
    2. Amature developers face some difficulties in staring, but once they are familiar it will be fun to code in Laravel.
    3. Community support is not as wide as a comparison to other frameworks.
    4. Upgrading framework is a headache.

  • What is Laravel service container?
    Laravel

    Posted By: Addison

    Service Container in Laravel is a Dependency Injection Container and a Registry for the application. It is one of the most powerful tool for managing class dependencies and performing dependency injection.

  • How To Use Delete Query In Laravel ?
    Laravel

    Posted By: Titus

    DB::table('table_name')->delete($id);

    is the simplest way to delete a record in Laravel.

  • How To Use Update Query In Laravel ?
    Laravel

    Posted By: Edie

    Updating a record in Laravel using Eloquent.

    $user=User::where(['id'=>1])->first();
    $user->name='abc';
    $user->age='22';
    $user->save();
    
    

  • What is Laravel Dusk?
    Laravel

    Posted By: Gabe

    Laravel Dusk is browser automation and testing tool introduced in Laravel 5.4. It uses ChromeDriver to perform browser automation testing.

  • What is Laravel Echo?
    Laravel

    Posted By: Firman

    Laravel Echo is a tool that makes it easy for you to bring the power of WebSockets to your Laravel applications. It simplifies some of the more common—and more complex—aspects of building complex WebSockets interactions.

    Echo comes in two parts: a series of improvements to Laravel's Event broadcasting system, and a new JavaScript package.

    Source: https://mattstauffer.com/blog/introducing-laravel-echo/

  • What is Laravel Homestead ?
    Laravel

    Posted By: Robin

    Laravel Homestead is an official, pre-packaged Vagrant "box" that provides you a wonderful development environment without requiring you to install PHP, HHVM, a web server, and any other server software on your local machine.

  • What is Tagging?
    Laravel

    Posted By: Esta

    Tagging is a package in Laravel that allow you to tag your content like pages/ post to a keyword.

  • What is dependency injection in Laravel ?
    Laravel

    Posted By: Leander

    Dependency injection or (D.I) is a technique in software Engineering whereby one object (or static method) supplies the dependencies of another object. A dependency is an object that can be used (a service). Injection is the passing of dependency to a dependent object (a client) that would use it.

    Basically, You can found 3 types of dependency injection:

    • Constructor injection
    • Setter injection
    • Interface injection

  • What are named routes in Laravel?
    Laravel

    Posted By: Vernie

    Named routing is another amazing feature of the Laravel framework. Named routes allow referring to routes when generating redirects or URLs more comfortably. You can specify named routes by chaining the name method onto the route definition:

    Example:

    Route::get('user/profile', function () {
        //
    })->name('profile');
    

    You can specify route names for controller actions:

    Route::get('user/profile', 'UserController@showProfile')->name('profile');
    
    

    Once you have assigned a name to your routes, you may use the route's name when generating URLs or redirects via the global route function:

    // Generating URLs...
    $url = route('profile');
    
    // Generating Redirects...
    return redirect()->route('profile');
    

    Source: http://www.laravelinterviewquestions.com/2017/07/named-routes-laravel.html

  • What are Laravel eloquent?
    Laravel

    Posted By: Hershel

    Eloquent is an ORM in Laravel that implements active record pattern and is used to interact with relational databases.

  • What is a Facade?
    Laravel

    Posted By: Thad

    In Programming, Facade is a software design pattern which is often used in object-oriented programming. Laravel facade is a class which provides a static-like interface to services inside the container.

  • How To Use Delete Statement In Laravel?
    Laravel

    Posted By: Loren

    Use delete statement in Laravel:

    In Query Builder Way:

    \DB::table('users')->delete($id); // delete with id
    \DB::table('users')->where('name', $name)->delete(); \\ delete with where condition
    

    In Eloquent Way:

     User::find($id)->delete() // delete with id
     User::where(['name'=>$name])->delete();  \\ delete with where condition
    
    

  • What is an Observer in Laravel?
    Laravel

    Posted By: Tommy

    An observer attaches to an Eloquent Model for Laravel.

    This observer can listen to many different events that happen on the model such as: creating, created, saving, saved, deleting, deleted and many more... All of which you can find here:

    https://laravel.com/docs/5.8/eloquent#events

    The observer listens for these events and fires whenever said action is triggered, letting you preform pre or post procedure statements whenever an action is taken.

     For instance, if you have a user registration page, and every time you create a user, you want to ensure that the password is hashed... You can hook into the User "creating" event.

     public function creating(User $user) {
      $user->password = bcrypt($user->password);

    }

     This will ensure that every time a user is created with a password, that password is automatically hashed.

     In order to register the Observer, you should place it in either the boot() section of your AppServiceProvider or your own custom provider. Note: if you use a custom provider, be sure to register it in config/app.php

    You will need the model and the observer. IE:

     

    boot() {
       User::observe(new UserObserver);
    }

    // That's it...

     

    Now any events that the User model fires will be performed by the User Observer if you have identified any in the observer.

  • How to get current Url in Laravel ?
    Laravel

    Posted By: Andreasdli

    In Laravel 5.5 or above you can use url()->current(); to get current URL without query string and  url()->full(); with the query string.

  • How To Use Select Query In Laravel?
    Laravel

    Posted By: Doctor

    DB::select('name')->table('users')->get();

    This will create a collection that only contains the 'name' property of ever user...

    DB::select('name','username')->table('users')->get();

    This will select name and username from users

  • Which template engine Laravel use ?
    Laravel

    Posted By: Webki Mad

    Laravel uses Blade template Engine.

  • How to use custom table in Laravel Model ?
    Laravel

    Posted By: Martha

    protected $table = 'custom_table_name';

    Attach this to your CustomModel.php

     

     

  • What are Closures in laravel ?
    Laravel

    Posted By: Oscar

    A Closure is an anonymous function that often used as callback methods and can be used as a parameter in a function.

    Example of Laravel Closure

    User::with('profile', function ($builder) {
    	// Get me all collapsed comments
    	return $builder->whereCollapsed(true);
    	
    });
    

  • How to get Logged in user info in Laravel ?
    Laravel

    Posted By: Cora

  • Does laravel support php 7?
    Laravel

    Posted By: Najim Mulla

    Yes, Laravel supports PHP 7.

  • What is Laravel Elixir ?
    Laravel

    Posted By: kristen gorge

    Laravel Elixir provides a clean, fluent API for defining basic Gulp tasks for your Laravel application. Elixir supports several common CSS and JavaScript pre-processors, and even testing tools. Using method chaining, Elixir allows you to fluently define your asset pipeline.

    Laravel Elixir Example

    elixir(function(mix) {
        mix.sass('app.scss')
           .coffee('app.coffee');
    });
    

  • What is the latest version of laravel?
    Laravel

    Posted By: Franklin

  • How can you display HTML with Blade in laravel
    Laravel

    Posted By: Bessie

  • How to install laravel via composer ?Syntax
    Laravel

    Posted By: Irwin

  • What are Cookies ? How to get , set , distroy cookies in Laravel ?
    Laravel

    Posted By: Clifton

  • How can you Exclude URIs From CSRF Protection in Laravel ?
    Laravel

    Posted By: Cecil

  • What getFacadeAccessor method does
    Laravel

    Posted By: Dell

  • What is CakePHP?
    Cakephp

    Posted By: Najim Mulla

    CakePHP is rapid development framework for PHP like Laravel it also flows MVC Design Pattern. It completly written in PHP and modeled after the concepts of Ruby on Rails. It is free use and and distributed under the MIT License.

    Some facts About CakePHP
    Distributed UnderMIT License
    First Released OnApril 2005
    Current Stable Version3.7.8
    ArchitetureMVC
    Written InPHP

  • How to get current URL in CakePHP ?
    Cakephp

    Posted By: Kausalya

    Getting current URL in CakePHP In CakePHP View

    <?php echo $this->here; ?>
    

    In Controller

    	<?php echo Router::url( $this->here, true ); ?> 
    

  • List some features of CakePHP framework ?
    Cakephp

    Posted By: Alcee

     Some features of CakePHP Frameworks are -

    •   Model Veiw Controller Pattern
    •   Object Relational Mapping
    •   Class inheritance
    •   No Configuration
    •   CRUD Scaffolding
    •   Built in Validation
    •   Easily extends with Plug-ins

  • What is MVC in CakePHP ?
    Cakephp

    Posted By: Lafayette

    Model View Controller (MVC) - targets the modern programming needs. CakePHP uses it just right with all the entities working together excellently and providing a great way to work on different aspects of development in a vitally planned system of data processing. 

    Model layer represents the logical part of our Application.It retrieves the data and convert it into meaningful concepts.

    Veiw layer shows the output to the end user.It process the input provided by the Model Layer and generates specific out put to the end user.

    Controller Layer is responsible for handling all requests coming from all users. It Collects the input from users and coordinate for the model and veiw codes.

     

     

  • How to write, read and delete the Session in cakephp?
    Cakephp

    Posted By: Haywood

    Reading session in cakePHP -

    $session->read('Config.language');

    Deleting session in cakePHP -

    $session->delete('Some.value');

  • What is symfony? List some features?
    Symfony

    Posted By: BorisIncive

  • What are symfony bundles?
    Symfony

    Posted By: Theodore

  • what are components in symfony?
    Symfony

    Posted By: Levy

  • Does laravel use symfony?
    Symfony

    Posted By: Sterling

  • Symfony logs are stored in which directory?
    Symfony

    Posted By: Hoyt

  • How to clear cache in Symfony?
    Symfony

    Posted By: Anamika Kumari

  • how to create a bundle in Symfony?
    Symfony

    Posted By: Authur

  • what are annotations in Symfony?
    Symfony

    Posted By: Elonzo

  • How to create an remove session in Symfony Framework?
    Symfony

    Posted By: Bascom

  • Explain What is FuelPHP?
    Fuel Php

    Posted By: Milo

  • What HMVC is Framework?
    Fuel Php

    Posted By: Herbertbot

  • List some advantages of FuelPHP?
    Fuel Php

    Posted By: Shivprasad

  • What is Presenter in FuelPHP?
    Fuel Php

    Posted By: Ed

  • List out the reserved routes in FuelPHP?
    Fuel Php

    Posted By: Eliseo

  • What is offical website of FulePHP?
    Fuel Php

    Posted By: David

  • List few benefits of HMVC?
    Fuel Php

    Posted By: Nomaan

  • How to get Query in FulePHP?
    Fuel Php

    Posted By: admin

  • What is Scaffolding in FuelPHP?
    Fuel Php

    Posted By: Pleas

  • What are the minimum server requirement to install Fuelphp?
    Fuel Php

    Posted By: jai

  • What is Lumen?
    Laravel

    Posted By: Orla

    Lumen is micro-framework by Laravel. It is developed by the creator of Laravel Taylor Otwell for creating smart and blazing fast API’s. Lumen is built on top components of Laravel. As Lumen is a micro-framework not a complete web framework like Laravel and used for creating API’s only, so most of the components as HTTP sessions, cookies, and templating are excluded from Lumen and only features like routing, logging, caching, queues, validation, error handling, database abstraction, controllers, middleware, dependency injection, Blade templating, command scheduler, the service container, and the Eloquent ORM are kept.

  • Difference between Contracts and Facades?
    Laravel

    Posted By: Freeman

    Contracts are an interface, while Facades are not an interface. it is a class. 

    Contracts are a set of interfaces that define the core services provided by the framework, while Facades provide a static interface to classes that are available in the application's service container.