In this short Laravel tutorial you will learn how to do a Laravel migration check to see if a column exists in a database table. By doing this migration check you can avoid a fatal error such as the following…
Tag: PHP
Check if an Array is Empty or Not in PHP
In this post, we will explore how to check if an array is empty in PHP using the empty() function and the count() function. I’ll provide you with the example code and then modify it in different ways to demonstrate…
Check If An Array Has Duplicate Values Example in PHP
In this simple tutorial I shall illustrate how to check whether a PHP array has duplicated values. In this simple example we will process an array to detect identical or duplicate values. If you want to detect duplicate values within…
PHP example of Null coalescing operator for shorthand If-Else operator
In this example we will see the use of the shortest shorthand of if-else statement to check isset variable in PHP programming language. Using Null coalescing operator we can write shortest if-else statement to check isset value and return it…
How to install LEMP stack on Ubuntu 22.04 LTS
Ubuntu is one the most popular Linux distributions. Ubuntu is a free and open-source software based on Debian. In this simple I will walk you through the whole process to install a LEMP stack (Linux, Ngnix, MySQL/Maridb & PHP) which…
How to use cURL in PHP, Working examples of cURL in PHP
What is cURL? cURL is a computer software project providing a code library (libcurl) and command-line tool (curl) for transferring data using various network protocols. Usually PHP comes loaded with libcurl library by default. Check if cURL is enabled in…
How to check if a string is a valid JSON object in PHP
You receive a data in form of string and it is supposed to be a valid JSON. So how to know whether a string you have is a valid JSON object. Here in this post I will show it with…
Array Destructuring With or Without List Function in PHP
Have you been unwillingly using the useful “extract” function to convert array elements into their corresponding names with same variable name as the key of the array element? Have you been worrying about the non-friendly nature of your code for…
Useful functions in Laravel and its Usage explained
There are many useful “helper” PHP functions in Laravel. According to documentation, “Many of these functions are used by the framework itself; however, you are free to use them in your own applications if you find them convenient.”
How to know the location of a function defined in PHP
Sometimes you want to know the location of a function defined in your php application. For example you are debugging a large online web application or website. To continue debug you want to enter into a function to debug. You…