Trim functions
📖 Scenario: Imagine you are working on a website where users enter their names and comments. Sometimes, users accidentally add extra spaces before or after their input. You want to clean up these inputs to store neat data.
🎯 Goal: You will create a PHP script that uses trim functions to remove unwanted spaces from user input strings.
📋 What You'll Learn
Create a variable with a string that has extra spaces at the start and end
Create a variable to hold the characters to trim
Use PHP trim functions to clean the string
Print the cleaned strings
💡 Why This Matters
🌍 Real World
Cleaning user input is important to store consistent data and avoid errors caused by extra spaces.
💼 Career
Many jobs require handling user data carefully, and knowing how to trim strings is a basic but essential skill.
Progress0 / 4 steps