menu

PHP Basics

PHP Basics - Important Points


21. Which of the following is used to replace a substring in a string in PHP?

A. str_replace()

B. replace()

C. substr_replace()

D. replace_substr()

Discuss Work Space

Answer: option a

Explanation:

The str_replace() function is used to replace a substring in a string in PHP.

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

A. split()

B. explode()

C. slice()

D. splitstring()

Discuss Work Space

Answer: option b

Explanation:

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

23. Which of the following is used to sort an array in ascending order in PHP?

A. sort()

B. asort()

C. ksort()

D. none of the above

Discuss Work Space

Answer: option a

Explanation:

The sort() function is used to sort an array in ascending order in PHP.

24. Which of the following is used to add an element to the end of an array in PHP?

A. array_push()

B. array_pop()

C. array_shift()

D. array_unshift()

Discuss Work Space

Answer: option a

Explanation:

The array_push() function is used to add an element to the end of an array in PHP.

25. Which of the following is used to remove the last element from an array in PHP?

A. array_push()

B. array_pop()

C. array_shift()

D. array_unshift()

Discuss Work Space

Answer: option b

Explanation:

The array_pop() function is used to remove the last element from an array 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