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

How to implement post type specific search in WordPress?

How to implement post type specific search in WordPress

Here we will discuss how we can implement a particular post type specific search functionality in WordPress. Before implementing post type specific search, we first need to know what post type is in WordPress. Post type in WordPress In WordPress, there are many different types of content. These types of content are usually defined as … Read more

How to implement search functionality in WordPress?

How to implement search functionality in WordPress

We can implement search functionality in WordPress in many ways. We will discuss these one by one. Processes to implement search functionality Process 1: Use WordPress function: We can generate a search form using the get_search_form() function in any of our theme files (for example, header.php). We can get more details about this function at … Read more

How to create disk at runtime and store file in Laravel?

How to create disk at runtime and store file in Laravel

In this article first we will know about Laravel driver and disk. Then we will know how to create disk at run time. What is driver and disk in Laravel? Laravel filesystem integration has drivers to work with local filesystems, FTP, SFTP, and Amazon S3. In Laravel filesystem the supported Drivers are: “local”, “ftp”, “sftp”, … Read more

How to write custom if statements in Laravel?

How to write custom if statements in Laravel

In this article I will create custom blade directive for blade template in Laravel. Laravel blade overview Blade is Laravel’s easy-to-use, high-performance templating tool. We can write simple PHP code inside our blade templates. In the case of blade template files, the file extension is .blade.php and they are usually located in resources/views directory. We … Read more

How to create event in Laravel?

How to create event in Laravel

In this article we will learn how to create event in Laravel with examples. Laravel event overview Laravel events have a straightforward observer pattern implementation. We can subscribe and listen to different events that happen in our application. The event class contains the information about the event. The event classes are stored in the app/Events … Read more

How to add custom cast type in Laravel?

How to add custom cast type in Laravel

What is casting in Laravel? With casting we can transform Eloquent attribute values when retrieving or set them on model instances. Casting does not require to define any additional methods on model. The $casts property is an array. The key of the array is the name of the attribute being cast and the value of … Read more

How to force HTTPS scheme in Laravel?

How to force HTTPS scheme in Laravel

Overview Hypertext Transfer Protocol Secure (HTTPS) is the secure version of HTTP. This is important when users are transmitting sensitive data. The browsers we use to access a website these days flag the website as insecure if it has an insecure URL like http://example.com/home. To have HTTPS in our website we need to purchase and … Read more

How to create custom facades in Laravel?

create custom facades in Laravel

In this article we will learn how to create custom facades in Laravel. But first we will know what facade is in Laravel. What is facade in Laravel? Facades provide a static interface to underlying classes in the service container. Facades also provide a memorable syntax to use Laravel’s features without remembering long class names … Read more