menu

PHP Strings

PHP Strings - Important Points


6. Which of the following functions is used to trim whitespace from the beginning and end of a string in PHP?

A. strrev()

B. substr()

C. strlen()

D. trim()

Discuss Work Space

Answer: option d

Explanation:

The trim() function is used to trim whitespace from the beginning and end of a string in PHP.

7. Which of the following functions is used to find the position of the first occurrence of a substring in a string in PHP?

A. strpos()

B. str_replace()

C. strlen()

D. substr()

Discuss Work Space

Answer: option a

Explanation:

The strpos() function is used to find the position of the first occurrence of a substring in a string in PHP.

8. Which of the following functions is used to reverse a string in PHP?

A. strrev()

B. substr()

C. strlen()

D. strtolower()

Discuss Work Space

Answer: option a

Explanation:

The strrev() function is used to reverse a string in PHP.

9. Which of the following functions is used to split a string into an array of substrings in PHP?

A. substr()

B. str_replace()

C. explode()

D. implode()

Discuss Work Space

Answer: option c

Explanation:

The explode() function is used to split a string into an array of substrings in PHP.

10. Which of the following functions is used to join the elements of an array into a string in PHP?

A. substr()

B. str_replace()

C. explode()

D. implode()

Discuss Work Space

Answer: option d

Explanation:

The implode() function is used to join the elements of an array into 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