array_column() Function Use In PHP 8.1 & PHP 8.2 With Example

The `array_column()` function in PHP is used to return the values from a single column in the input array. It is especially useful when dealing with arrays of associative arrays or objects. Here’s the syntax for `array_column()`: <?php array_column(array $input, string|int|null $column_key, string|int|null $index_key = null): array ?> – `$input`: The multi-dimensional array (typically an […]

See More

substr_compare() Function in PHP 8.2 With Example

`substr_compare()` is a PHP function used to compare parts of two strings. It allows you to compare substrings of two given strings starting from a specified position and up to a specified length. This function returns 0 if the substrings are equal, a negative value if the substring of the first string is less than […]

See More

strripos() Function in PHP 8.2 With Example

In PHP, the strripos() function is used to find the position of the last occurrence of a substring (case-insensitive) within a string. It is similar to the strrpos() function, but it performs a case-insensitive search.This is the case-insensitive version of strrpos(). Example: <?php $text = “This is a test string. This is another test.”; $position […]

See More

strrpos() Function in PHP 8.2 With Example

The `strrpos()` function in PHP is used to find the position of the last occurrence of a substring within a string. It searches for the last occurrence of a specified substring (needle) within a string (haystack). If the substring is found, `strrpos()` returns the position of the last occurrence of the substring in the haystack. […]

See More

strchr() Function in PHP 8.2 With Example

In PHP, the `strchr()` function is used to find the first occurrence of a character in a string and return the rest of the string starting from that character. It’s similar to the `strstr()` function, but `strchr()` has its parameters reversed. Here’s the syntax of the `strchr()` function: <?php strchr(string $haystack, mixed $needle, bool $before_needle […]

See More

strncasecmp() Function in PHP 8.2 With Example

If you specifically need a case-insensitive comparison with a limited number of characters, you can achieve this by combining `strcasecmp()` with `substr()` to compare a substring of each string. Here’s an example: <?php // Define two strings $string1 = “Hello World”; $string2 = “HELLO world”; // Compare the first 5 characters of each string in […]

See More

strval() Function in PHP 8.2 With Example

In PHP, the `strval()` function is used to convert a variable to a string. It’s particularly useful when you want to ensure that a variable is treated as a string, regardless of its original type. Here’s how `strval()` works: <?php string strval ( mixed $var ) ?> The `strval()` function takes one argument, `$var`, which […]

See More

strtok() Function in PHP 8.2 With Example

In PHP, there isn’t a built-in function named `strtok()` in the standard library as you might find in other languages like C. However, PHP does have a similar function called `explode()` or `preg_split()` which can achieve similar functionality. Here’s how you can use `explode()` to split a string into an array based on a delimiter: […]

See More

ord() Function in PHP 8.2 With Example

In PHP, the `ord()` function is used to get the ASCII value of the first character of a string. Here’s how you can use it with an example: <?php // Example string $string = “Hello”; // Using ord() function to get ASCII value of the first character $asciiValue = ord($string[0]); // Displaying the ASCII value […]

See More

hex2bin() Function in PHP 8.2 With Example

In PHP, the `hex2bin()` function is used to convert hexadecimal strings to binary strings. This function was introduced in PHP 5.4.0. Here’s how you can use `hex2bin()` in PHP 8.2 with an example: <?php // Hexadecimal string $hexString = “48656c6c6f20576f726c64”; // “Hello World” in hexadecimal // Convert hexadecimal string to binary $binaryString = hex2bin($hexString); // […]

See More

bin2hex() Function in PHP 8.2 With Example

Hello Friends Today, through this tutorial, I will tell you How to Use `bin2hex()` function using PHP, PHP 8, PHP 8.1, PHP 8.2 With Example. The `bin2hex()` function in PHP is used to convert binary data into hexadecimal representation. Here’s how you can use it with an example: <?php // Binary data $binaryData = “Hello, […]

See More

http_build_query() Function in PHP 8.2 With Example

The `http_build_query()` function in PHP is used to generate a URL-encoded query string from an associative (or indexed) array. It’s commonly used when you need to construct a query string to be appended to a URL in HTTP requests. This function is particularly useful when dealing with forms and constructing URLs with dynamic parameters. Here’s […]

See More

chr() Function in PHP 8.2 With Example

Hello Friends Today, through this tutorial, I will tell you How to Use `chr()` function using PHP, PHP 8, PHP 8.1, PHP 8.2 With Example. In PHP, the `chr()` function is used to return a character based on the ASCII code provided. Here’s how you can use `chr()` function in PHP 8.2 with an example: […]

See More

rawurldecode() Function in PHP 8.2 With Example

Hello Friends Today, through this tutorial, I will tell you How to Use `rawurldecode()` function using PHP, PHP 8, PHP 8.1, PHP 8.2 With Example. In PHP, the `rawurldecode()` function is used to decode a URL-encoded string. It is particularly useful when dealing with URLs where special characters like spaces, slashes, and others are encoded. […]

See More

urldecode() Function in PHP 8.2 With Example

Hello Friends Today, through this tutorial, I will tell you How to Use `urldecode()` function using PHP, PHP 8, PHP 8.1, PHP 8.2 With Example. In PHP, `urldecode()` is a function used to decode URL-encoded strings. It takes a string that has been encoded with `urlencode()` or similar functions and decodes it back to its […]

See More

str_ireplace() Function in PHP 8.2 With Example

In PHP, the `str_ireplace()` function is used to replace occurrences of a search string with another string in a given string, ignoring case sensitivity. This function is available in PHP 8.2 as well. Here’s how you can use `str_ireplace()` with an example: <?php // Example string $string = “The quick brown fox jumps over the […]

See More

money_format() Function in PHP 7.4 With Example

The `money_format()` function in PHP is used to format a number as a currency string based on a specified format. However, as of PHP 7.4, `money_format()` function is deprecated. Therefore, it’s not available in PHP 8.2. Instead, you can use `number_format()` function along with appropriate formatting to achieve similar results. Here’s an example: <?php // […]

See More

How to Use str_word_count() Function in PHP 8.2 With Example?

Hello Friends Today, through this tutorial, I will tell you How to Use `str_word_count()` function using PHP, PHP 8, PHP 8.1, PHP 8.2 With Example. In PHP 8.2, the `str_word_count()` function is used to count the number of words in a string. It provides several options to customize its behavior. Below is an example demonstrating […]

See More

How to Use htmlspecialchars_decode() Function in PHP 8.1 and 8.2 with Example?

In PHP, the `htmlspecialchars_decode()` function is used to convert special HTML entities back to their corresponding characters. This function is particularly useful when you want to decode HTML entities that have been encoded using the `htmlspecialchars()` or `htmlentities()` functions. Here’s how you can use `htmlspecialchars_decode()` in PHP 8.1 and 8.2 with an example: <?php // […]

See More

How to Use implode() Function in PHP 8.1 and 8.2 With Example

Hello Friends Today, through this tutorial, I will tell you How to Use `implode()` function using PHP, PHP 8, PHP 8.1, PHP 8.2 With Example. In PHP, the `implode()` function is used to join elements of an array into a single string, with each element separated by a specified delimiter.`implode()` function has been available in […]

See More

str_shuffle() Function in PHP With Example

Hello Friends Today, through this tutorial, I will tell you How to Use `str_shuffle()` function using PHP, PHP 8, PHP 8.1, PHP 8.2 With Example. In PHP, `str_shuffle()` is a built-in function used to randomly shuffle the characters of a string. It returns a string with the same characters as the input string but in […]

See More

strrchr() Function in PHP With Example

Hello Friends Today, through this tutorial, I will tell you How to Use `strrchr()` function using PHP, PHP 8, PHP 8.1, PHP 8.2 With Example. In PHP, the `strrchr()` function is used to find the last occurrence of a character in a string and return the portion of the string starting from that character until […]

See More

stristr() Function in PHP With Example

Hello Friends Today, through this tutorial, I will tell you How to Use `stristr()` function using PHP, PHP 8, PHP 8.1, PHP 8.2 With Example. In PHP, the `stristr()` function is used to perform a case-insensitive search for a substring within another string. This function returns the part of the haystack (the string being searched) […]

See More

strnatcmp() Function in PHP 8.1 and 8.2

Hello Friends Today, through this tutorial, I will tell you How to Use `strnatcmp()` function using PHP, PHP 8, PHP 8.1, PHP 8.2 With Example. In PHP 8.1 and 8.2, the `strnatcmp()` function remains unchanged from previous versions. This function is used to compare two strings in a natural order case-sensitive manner. Natural ordering means […]

See More

strcasecmp() Function in PHP With Example

Hello Friends Today, through this tutorial, I will tell you How to Use `strcasecmp()` function using PHP, PHP 8, PHP 8.1, PHP 8.2 With Example. In PHP, `strcasecmp()` is a function used to compare two strings in a case-insensitive manner. This function is available in both PHP. It returns 0 if the two strings are […]

See More

strcmp() Function in PHP 8

Hello Friends Today, through this tutorial, I will tell you How to Use `strcmp()` function using PHP, PHP 8, PHP 8.1, PHP 8.2 With Example. In PHP, the `strcmp()` function is used to compare two strings. It returns 0 if the two strings are equal, a negative value if the first string is less than […]

See More

Concatenate Strings in PHP 8.1 & 8.2

Hello Friends Today, through this tutorial, I will tell you How do you concatenate strings using PHP, PHP 8, PHP 8.1, PHP 8.2, PHP 8.3 With Example. In PHP 8.1 and PHP 8.2, you can concatenate strings using the `.` (dot) operator or the `concat()` function. Here’s how you can use both methods: Using the […]

See More

Convert a String to uppercase in PHP 8

Hello Friends Today, through this tutorial, I will tell you How do you convert a string to uppercase using PHP, PHP 8, PHP 8.1, PHP 8.2, PHP 8.3 With Example. In PHP 8 & 8.1, you can convert a string to uppercase using the `mb_strtoupper()` function, which supports multi-byte character encoding. Here’s how you can […]

See More

Convert a String to Lowercase in PHP 8

Hello Friends Today, through this tutorial, I will tell you How do you convert a string to lowercase using PHP, PHP 8, PHP 8.1, PHP 8.2, PHP 8.3 With Example. In PHP 8, you can convert a string to lowercase using the `strtolower()` function. Here’s how you can use it: <?php // Original string $string […]

See More