How-to articles, tricks, and solutions about PHP

How to Generate One-Time Password in PHP

On this page, we cover a common issue that almost all the developers come across: generating one time password with PHP that can be reliable and helpful.

How to Generate Static Classes in PHP

This snippet will assist you in working with classes in PHP. Learn how to generate static classes with the help of our guidelines.

How to Get a File Extension in PHP

Here, we have collected five simple and efficient ways that will help you to get a PHP file extension. Check out the examples and choose the best one.

How to get a substring between two strings in PHP?

You can use the strpos function to find the position of the first occurrence of a substring in a string, and then use the substr function to extract the desired substring.

How to get a Youtube channel RSS feed after 2015 April 20 (without v3 API)?

After April 20, 2015, YouTube discontinued support for the RSS feed feature in the version 2 of their API.

How to get all rows (soft deleted too) from a table in Laravel?

In Laravel, you can use the withTrashed() method to retrieve all the rows, including the soft deleted ones, from a table.

How to get AM/PM from a datetime in PHP

To get the AM/PM value for a given date and time in PHP, you can use the date() function with the a format string.

How to get an array of specific "key" in multidimensional array without looping

You can use the array_column function to get an array of specific keys from a multidimensional array.

How to get body of a POST in php?

To get the body of a POST request in PHP, you can use the file_get_contents function and pass it the special php://input stream.

How to get client IP address in Laravel 5+

In Laravel, you can get the client's IP address by using the Request facade's ip method.

How to get Current Timestamp from Carbon in Laravel 5

You can use the now() method from the Carbon class to get the current timestamp in Laravel.

How to get everything after a certain character?

You can use the strstr() function to get everything after a certain character in a string.

How to get file URL using Storage facade in laravel 5?

To get the URL of a file using the Storage facade in Laravel 5, you can use the url method.

How to get file_get_contents() to work with HTTPS?

To get file_get_contents() to work with HTTPS, you may need to make sure that PHP has been compiled with the OpenSSL extension.

How to get id from URL in codeigniter?

In CodeIgniter, you can get the value of the id from the URL by using the function $this->uri->segment(n), where n is the position of the segment you want to retrieve.

How to get ID of the last updated row in MySQL?

To get the ID of the last inserted row, you can use the LAST_INSERT_ID() function.

How to get info on sent PHP curl request

To get information about a cURL request that you have sent using PHP, you can use the curl_getinfo() function.

How to get last insert id in Eloquent ORM laravel

In Laravel, you can use the save method provided by Eloquent to insert a new record and retrieve the last insert ID.

How to get last key in an array?

You can use the end() function to get the last element of an array in PHP.

How to get Magento customer ID

In Magento, you can get the customer ID of a logged-in customer using the following code:

How to Get Multiple Selected Values of the Select Box in PHP

Learn how to get multiple selected values of the selected box in PHP. In our snippet, we provide you with comprehensive information and handy examples.

How to get page content using cURL?

To get the content of a webpage using cURL, you can use the following command:

How to Get Parameters from a URL String with PHP

Learn how to get the parameters from a URL string in PHP with the help of our short tutorial. Read on and check out the helpful examples below.

How to get primary key of table?

To get the primary key of a table in PHP, you can use the SHOW KEYS SQL statement to retrieve information about the keys (including the primary key) of a table.

How to Get Remote IP Address in PHP

Sometimes getting the IP address of the client can be tricky. With the help of this snippet, you will manage to get the real remote IP address in PHP.