How to search a multi dimensional array in PHP?

How to search a multi dimensional array in PHP

We know that an array is a built-in data type of PHP that stores a number of values in one single variable. A multidimensional array is a type of an array that can store one or more than one arrays. I have discussed about array and different types of array in my previous post which … Read more

Categories PHP

What is trait in PHP?

What-is-trait-in-PHP

Trait in PHP PHP is a single inheritance language. It means a child class can inherit only from only one parent in PHP. I have added a diagram below to illustrate how single inheritance works in PHP. In the above example we can see that Class A is the root level parent class. Class B … Read more

Categories PHP

What is the difference between interface and abstract class in PHP?

What is the difference between interface and abstract class in PHP

One of the most important concepts in object oriented programming is abstract class and interface. In this article, we will learn the difference between interface and abstract class in PHP. Before that, we will learn what is the interface and abstract class And how to use them in PHP. What is an interface? Interfaces are … Read more

Categories PHP

What is an associative array in PHP?

associative array in PHP

In this article We will discuss in detail about associative array in PHP. In this article We will first discuss array and different types of array in PHP. While discussing different types of arrays, we will discuss the basics of associative arrays. And then We will discuss different aspects of associative arrays in more detail. … Read more

What is recursive function in PHP?

What-is-recursive-function-in-PHP

Defining Recursive function Recursion is a programming approach in which a function calls itself and the function is called a recursive function. This function call is made until a certain condition is met. This has to be handled very carefully to avoid infinite loops. Understanding the factorial example To understand how recursive functions work, we … Read more

Categories PHP

What is the difference between implode and explode in PHP?

What is the difference between implode and explode in PHP

The two functions implode() and explode() are in-built PHP functions. Before knowing the difference between these two functions, we will know how these functions work. implode function We will know the definition, syntax, parameters, return values, and an example code of the implode() function one by one. Definition The implode functions join array elements to … Read more

Categories PHP

What is data type in PHP?

What-is-data-type-in-PHP

Data type and variable in PHP Data type defines what type of value a variable can store. In programming language, a variable is a value that can change. PHP is a dynamically typed language. In dynamically typed language it is not required to specify the type of a variable because the type will be set … Read more

Categories PHP

How to convert an object to an array in PHP?

convert an object to an array in PHP

Before knowing how to convert from an object to an array in php, we will know what objects and arrays are in php. Object and Array are built-in data types of PHP. Object in PHP Definition An object is an instance of a class. To create an object new keyword is used. A class is … Read more

Categories PHP

How to convert an array to a string in PHP?

How-to-convert-an-array-to-a-string-in-PHP

Before knowing how to convert from an array to a string in PHP, we will know what array and string are in PHP. String and Array are built-in data types of PHP. What is a string? A string is a collection of characters (character is equivalent to a byte). Example of a string An example … Read more