menu

PHP Strings

PHP Strings - Important Points


16. Which of the following functions is used to count the number of occurrences of a substring in a string in PHP?

A. strpos()

B. str_replace()

C. substr_count()

D. strlen()

Discuss Work Space

Answer: option c

Explanation:

The substr_count() function is used to count the number of occurrences of a substring in a string in PHP.

17. Which of the following functions is used to convert a string to an array in PHP?

A. str_split()

B. explode()

C. implode()

D. substr()

Discuss Work Space

Answer: option a

Explanation:

The str_split() function is used to convert a string to an array in PHP.

18. Which of the following functions is used to convert an array to a string in PHP?

A. str_split()

B. explode()

C. implode()

D. substr()

Discuss Work Space

Answer: option c

Explanation:

The implode() function is used to convert an array to a string in PHP.

19. Which of the following functions is used to compare two strings in PHP?

A. strcmp()

B. str_replace()

C. strlen()

D. substr()

Discuss Work Space

Answer: option a

Explanation:

The strcmp() function is used to compare two strings in PHP.

20. Which of the following functions is used to extract a substring from a string in PHP?

A. strpos()

B. str_replace()

C. substr()

D. strlen()

Discuss Work Space

Answer: option c

Explanation:

The substr() function is used to extract a substring from a string in PHP.


Subscribe for Latest Career Trends
Subscribe Now
Use AI and ChatGPT for Career Guidance

Unlock Your Future

Join Now
Worried for Placements in 2024?

Join FAST TRACK Course

Join Now
Supercharge Your SUCCESS

Join All in One Placement Mock Tests-2024

Join Now