Challenge: Manipulating the String and Array with Advanced Methods

A hands-on exercise to test your knowledge of the functional differences introduced in PHP 8.

Follow the instructions for the tasks to complete this lesson.

Task 1

  • Implement a PHP 8 script that adds the given strings and numeric values.

  • Use new string handling methods introduced in PHP 8.

  • Print the result to the console.

  • Compare the string and numeric value.

  • Display the result of the comparison.

  • Use the nested ternary operator for the comparison.

  • Display the output result.

Instructions

  • Use the format string to display the result in the following pattern.

Get hands-on with 1200+ tech skills courses.