menu

Web Development With PHP

Web Development With PHP - Important Points


21. Which of the following is NOT a valid way to concatenate two strings in PHP?

A. $string1 . $string2

B. $string1 + $string2

C. $string1 .= $string2

D. $string1, $string2

Discuss Work Space

Answer: option b

Explanation:

The + operator is used for arithmetic operations in PHP, not string concatenation. String concatenation is done using the dot (.) operator.

22. Which PHP function is used to generate a random number?

A. rand()

B. random()

C. randomize()

D. random_number()

Discuss Work Space

Answer: option a

Explanation:

The rand() function is used to generate a random number in PHP.

23. Which of the following is NOT a valid loop in PHP?

A. for

B. while

C. do-while

D. repeat-until

Discuss Work Space

Answer: option d

Explanation:

The repeat-until loop is not a valid loop in PHP. Instead, the do-while loop is used.

24. Which PHP function is used to retrieve the length of a string?

A. length()

B. size()

C. strlen()

D. count()

Discuss Work Space

Answer: option c

Explanation:

The strlen() function is used to retrieve the length of a string in PHP.

25. Which of the following is NOT a valid comparison operator in PHP?

A. ==

B. !=

C. <=>

D. ><

Discuss Work Space

Answer: option d

Explanation:

The >< characters are not a valid comparison operator in PHP. The <=> operator is used to compare two values and return either -1, 0, or 1 depending on the result of the comparison.


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