PHP

How to build query string from an array with http_build_query in PHP

PHP has built in function http_build_query that can be used to prepare a query string from an array. Instead of explicitly appending elements to string, this function comes handy, which takes cares of generating URL-encoded query string either from an associative or indexed array.

How to build query string from an array using Laravel helper

Laravel provide a helper Arr::query() to build query string from an array, an alternative to core php http_build_query() method. Tested with Laravel versions 5.8, 6 and 7. Kindly check for your version on official helpers page.

Convert hexadecimal color to rgb or rgba in php

Below PHP helper function converts hex color code string into RGB or RGBA color.

Get Array of IDs from Eloquent Collection in Laravel

A tutorial how to get array of ids from Eloquent Collection in Laravel

What’s New in PHP 7.4

PHP 7.4 coming with all new features and updates on November 28th, 2019.

How to find the array index key of multi-dimensional array

array_search() is a built in PHP function that searches the array for a given value and returns the first corresponding key if successful. Syntax array_search ( mixed $needle , array $haystack [, bool $strict = FALSE ] ) : mixed Support: (PHP 4 >= 4.

How to Get Values from Multi-dimensional Arrays with array_column()

array_column() is an inbuilt PHP function which can be used to get the values from a single column from the given multi-dimensional array or an array of objects. Syntax array array_column ( array $input , mixed $column_key [, mixed $index_key = NULL ] ) Support: (PHP 5>=5.