
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 1060 Articles for PHP

6K+ Views
In this article, we will learn about pass by value and pass by reference in PHP. Now, let’s understand these two concepts in detail.In PHP generally, we followed to pass the arguments to the function with passed by value approach. We are following this practice because if the value of the argument within the function is changed, it does not get changed outside of the function.In some cases we may need to modify function arguments, So to allow a function to modify its arguments, they must be passed by reference.Let's begin with passed by reference. As it is already mentioned we ... Read More

15K+ Views
In this article, we learn the best way to create getter and setter strategies in PHP. Getter and setter strategies are utilized when we need to restrict the direct access to the variables by end-users. Getters and setters are methods used to define or retrieve the values of variables, normally private ones.Just as the name suggests, a getter method is a technique that gets or recovers the value of an object. Also, a setter method is a technique that sets the value of an object.ExampleLet's understand the use of getter and setter methods through an example.Output:PHP Error Cannot access private ... Read More

12K+ Views
To begin with, Polymorphism is gotten from the Greek words Poly (which means many) and morphism (which meaning forms).Polymorphism portrays an example in object-oriented programming where methods in various classes that do similar things should have a similar name. Polymorphism is essentially an OOP pattern that enables numerous classes with different functionalities to execute or share a commonInterface. The usefulness of polymorphism is code written in different classes doesn't have any effect which class it belongs because they are used in the same way. In order to ensure that the classes do implement the polymorphism guideline, we can pick between ... Read More

39K+ Views
A PHP application produces many levels of errors during the runtime of the script . So in this article, we will learn how to display all the errors and warning messages. The quickest way to display all php errors and warnings is to add these lines to your PHP code file: ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); The ini_set function will try to override the configuration found in your php.ini file. If in the php.ini file display_error is turned off it will turn that on in the code. It also set display_startup_errors to true to show the error message. error_reporting() ... Read More

369 Views
In this article, we are going to learn about namespace in PHP. In PHP when we are creating large applications or when integrating third-party applications/library then there may be chances of collision between class names, function names. So to avoid these problems PHP "Namespaces" provide a way in which to group related classes, interfaces, functions and constants.Let's see the syntax of declaring namespace below.SyntaxIn the PHP world, namespaces are intended to take care of two issues that creators of libraries and applications experience when making re-usable code components, Those are:1.Name impact between code you create, and internal PHP classes/functions/constants or ... Read More

353 Views
To display two decimals, use number_format(). Let us first write the PHP code for the same. We have first declared two variables are initialized −$number1=10.3423; $number2=10;Now, display the two decimals using the number_format() function −$result1=number_format ($number1, 2); $result2=number_format ($number2, 2);ExampleFollowing is the example −OutputFollowing is the snapshot of PHP code −10.34 10.00

10K+ Views
Method Overloading is a concept of Object Oriented Programming which helps in building the composite application in an easy way. Function overloading or method overloading is a feature that permits making creating several methods with a similar name that works differently from one another in the type of the input parameters it accepts as arguments.The above concept is fine for other programming languages and it is called static polymorphic i.e method overloading.ExampleLet's understand through an example.Output:ErrorExplanation:This will generate an error since php will say you have declared this method twice.But Other programming languages says , doTask($var1) and doTask($var1, $var2) are ... Read More

4K+ Views
In this article, we will learn about useful and important functions in PHP for file inclusion. All these functions require, require_once, include and include_once are utilized to include the files in the php page but there is a slight distinction among them in terms of functionality.Let's discuss these functions below with their functionality.include() :This function is used to include a file in a PHP page. If include() function is not able to find a specified file on location at that time it will throw a warning message however, it will not stop script execution.require():This function is utilized to add a ... Read More

1K+ Views
PHP5 added the object-oriented programming approach with the previous version, which is used for making code reusable in real time php application.Some of the concepts of object-oriented models are: class, object, encapsulation, polymorphism, abstract and final classes, and methods, interfaces and inheritance, etc...Here we discuss the basic differences between abstraction and encapsulation.Encapsulation:Encapsulation is an approach that joins data members(variables) and implementation details into a single unit called the class that implies class is formed with variables and methods present inside it.Encapsulation is a protection mechanism for data members present inside the class i.e data members are not accessible by end ... Read More

1K+ Views
The final keyword is introduced by PHP5 related to the object-oriented programming concept.But before we move on to the final, we need to ensure that we have a good understanding of the inheritance concept. In inheritance, we can inherit a class from another class. Also, we can override a function in an inherited class, to replace the behavior originally provided. In some cases, we might need to keep a class from being inherited from or we may need to prevent a function to be overridden. This can be achieved with the final, by prefixing the class and function with the ... Read More