PHP Program to Print Prime Numbers between 1 to N using Sieve Algorithm

Write a php program to print prime numbers between 1 to N. In this tutorial, we are going to use Sieve of Eratosthenes algorithm to print prime numbers between 1 to N.

Binary Search in PHP : Explain with Code Examples

Write a program to implement binary search in PHP. Given a sorted array, we have to write a PHP code to search an element using binary search algorithm.

Subscribe Our Tutorials

Get Latest Updates on Facebook

PHP Composer : Manage Package Dependency in PHP

What’s a PHP composer? How to use PHP composer in your PHP Application? What are the benefits of using composer in your application?

PHP Composer is a dependency manager. It manages the dependency of PHP packages in your application. Using composer you can pull the required library and dependencies and manage them in one place. The concept of a composer is similar to npm in node.js and gem in Ruby.

Let’s first understand what is a dependency.

Magic Methods in PHP

What are PHP Magic Methods?

PHP Magic methods are a specialized method that is executed in response to a specific event. Each magic methods start with two underscores(__) and it is called automatically when a certain condition is met. It triggers custom behaviors defined by a programmer inside the class. Some of the magic methods are __construct(), __destruct(),  __toString(),  __get(),  __set(), __call() etc.

In this tutorial, we are going to explore these magic methods.

PHP Magic Methods

PHP Magic Methods