Posts

CodeIgniter Interview Questions

CodeIgniter is an open-source MVC based framework for PHP. It is a loosely coupled framework that we can use for the rapid development of websites and mobile APIs. 1) How to check the version of the CodeIgniter framework? In system/core/CodeIgniter.php, check CI_VERSION constant value define(‘CI_VERSION’, ‘3.0.6’); 2) How to set CSRF token in CodeIgniter? CSRF is used to set the protection in CodeIgniter. To set CSRF, you have to put the corresponding config value True. Syntax: $config['csrf_protection'] = TRUE; 3) How many types of messages you can log in to CodeIgniter? There are three message types in Codeigniter. They are : Error Messages. These are actual errors, such as PHP errors or user errors. Debug Messages. These are messages that assist in debugging. For example, if a class has been initialized, you could log this as debugging info. Informational Messages. These are the lowest priority messages, simply giving information regarding some process.

Object Oriented Programming (OOPs) Concepts in PHP

Class -  Class is the template which contains class members. class members are properties and methods. Property - Variable declared within the class. Method - Function declared within the class. Object -  An object is the memory location of the class variables. We can access the class variables with the support of object. New -  By using this keyword we can allocate space in the new memory locations to load class content. Constructor -  The constructor is one the type of method which is having class name same as method name. By default, every class contains a default constructor used to load class constraints. In PHP we can use constructor in two ways - Using constructor keyword (default constructor) - __constructor(). Using class name - className(). Destructor -  Destructor is the special type of method, which can be executed at the time of destroying object of class. By using __destructor() we can create destructor. In PHP , the class objects w

Basic PHP Interview Questions?

1) What is PHP?  PHP is a server-side scripting language that is basically used for developing dynamic web pages.  2) What is the difference between echo( ) and print ( )? echo and print are more or less the same. They are both used to output data to the screen.The differences are small: echo has no return value while print has a return value of 1 so it can be used in expressions. echo can take multiple parameters while print can take one argument. echo is marginally faster than print.  3) What is print_r( )? This is also an output function used in PHP, It is used to display the whole array in PHP.  4) How to include files in PHP? We can include a file using "include( )" or "require( )" function with file path as its parameter. 5) What is the difference between GET and POST? We can send small data using GET method but POST method can transfer a large amount of data and POST is secure method than GET method.  7) How to declare an array in P

Difference between unset() and unlink() in PHP

In PHP unlink() is a function for file system handling, unlink() is used to delete files (physical). Suppose you have uploaded a file and wants to delete this file through the coding then unlink() function is used to delete the file, Suppose you have an image with the name test.png and you wants to delete this image then use the <?php /****Condition*****/ /****Condition*****/ unlink(image path/test.png); /****Condition*****/ /****Condition*****/ ?> or <?php $xx = fopen('testing.html', 'a'); fwrite($xx, '<h1>Hello EWA!</h1>'); fclose($xx); unlink('testing.html'); ?> unset() is a function for variable management. It will make a variable undefined. Or we can say that unset() is used to null out the value of a given variable. OR Unset () is used to destroy a variable in PHP. In can be used to remove a single variable, multiple variables, or an element from an array. Example for unset() : <?php $value =

List of MySQLi function

The MySQLi functions allow you to access MySQL database servers. Note: The MySQLi extension is designed to work with MySQL version 4.1.13 or newer. Function Description mysqli_affected_rows() Returns the number of affected rows in the previous MySQL operation mysqli_autocommit() Turns on or off auto-committing database modifications mysqli_change_user() Changes the user of the specified database connection mysqli_character_set_name() Returns the default

PHP isset() vs empty() vs is_null()

PHP has different functions which can be used to test the value of a variable. Three useful functions for this are isset(), empty() and is_null(). All these function return a boolean value. If these functions are not used in correct way they can cause unexpected results. isset() and empty() are often viewed as functions that are opposite, however this is not always true. In this post I will explain the differences between these functions. isset() From PHP manual – isset(): isset — Determine if a variable is set and is not NULL In other words, it returns true only when the variable is not null. empty() From PHP Manual – empty(): empty — Determine whether a variable is empty In other words, it will return true if the variable is an empty string, false, is_null() From PHP Manual – is_null(): is_null — Finds whether a variable is NULL In other words, it returns true only when the variable is null. is_null() is opposite of isset(), except for one difference that i

AJAX Interview Questions

1) What are the usages of SQL? To execute queries against a database To retrieve data from a database To inserts records in a database To update records in a database To delete records from a database To create new databases To create new tables in a database To create views in a database 2) Does SQL support programming? No, SQL doesn't have loop or Conditional statement. It is used like commanding language to access databases. 3) What are the subsets of SQL? Data definition language (DDL) - Data definition language(DDL) allows you to CREATE, ALTER and DELETE database objects such as schema, tables, view, sequence etc. Data manipulation language (DML) - Data manipulation language makes user able to access and manipulate data. It is used to perform following operations. Insert data into database Retrieve data from the database Update data in the database Delete data from the database Data control language (DCL) - Data control

Basic Terminology

What is scripting language? A scripting language is a programming language that supports scripts programs written for a special run time environment that can interpret (rather than compile) automates and executes the tasks that could be alternatively executed by human operator. What is static Web pages? A static web page is the web page that delivered to user exactly as stored in contrast to dynamic web pages which are generated by a web application. What is Dynamic Web Pages?   A server side dynamic web page is controlled by an application server processing server side scripting. What is web server? Web server is the software used to run web application, Main functionality of server is to handle the request from the client and send response to client. What is web browser? The web browser is the software used to open the web application from the web server. Web browser can also execute HTML, Java Script, CSS and other client side script. What is

Introduction To PHP

PHP stands for Highpertext Preprocessor. PHP is a widely used open-source scripting language. PHP is web technology implemented by Rasmus Lerdorf in 1995. PHP is implemented using C & Perl software. PHP is a server-side scripting language used in implementing dynamic web pages. PHP is maintained by Zend Organization. What is PHP? PHP is basically server-side scripting language which is basically used for developing dynamic web pages. Why PHP? PHP code can run on any platform like windows, mac, linux etc. PHP is computable with all the web servers used today. PHP supports wide range of databases. PHP is easy to learn and it is freely available.