Subjects

All subjects Django Java Python React Spring Boot JavaScript PHP
Sign Up Free
PHP 10 questions

Arrays & String Functions

Learn key PHP array and string manipulation methods. Essential for sorting, filtering, merging, and text processing in technical interviews.

More PHP
Interview questions 1–10 of 10
1

What are the most commonly used array functions in PHP?

PHP has over 80 built-in array functions. These are the ones that come up most in day-to-day code and intervie...

Read answer →
2

What is the difference between array_map, array_filter, and array_reduce?

All three take a callback and an array, but they do fundamentally different things.FunctionPurposeReturnsarray...

Read answer →
3

How do you sort arrays in PHP? Explain sort, ksort, and usort.

Short Answer Indexed Arrays use numeric keys (starting from 0 by default) to store and access data. Associati...

Read answer →
4

What is the difference between explode() and implode() in PHP?

explode() splits a string into an array using a delimiter. implode() (alias: join()) joins array elements into...

Read answer →
5

What is the difference between array_merge() and the + operator for combining arrays?

Both combine two arrays, but they handle duplicate keys very differently.Aspectarray_merge()+ operatorString k...

Read answer →
6

What are the most useful PHP string functions? (strlen, substr, str_replace, trim)

FunctionPurposeExamplestrlen($str)Get string length in bytesstrlen('Hello') = 5substr($str, $start, $len)Extra...

Read answer →
7

What is the difference between strpos() and stripos()?

Both find the position of the first occurrence of a substring within a string. The only difference is case sen...

Read answer →
8

How do you check if a value exists in an array? (in_array, array_search, array_key_exists)

FunctionChecksReturnsin_array($needle, $arr)Is this value present anywhere in the array?true / falsearray_sear...

Read answer →
9

How do you remove duplicate values from an array in PHP?

Use array_unique() for simple scalar arrays, or a combination approach for arrays of associative sub-arrays wh...

Read answer →
10

How do you format strings and numbers in PHP? (sprintf, number_format, str_pad)

FunctionPurposeExamplesprintf($format, ...$args)Build a formatted string using placeholderssprintf('%05d', 42)...

Read answer →