Beginning PHP - Challenge help

No replies
Last seen: 8 years 51 weeks ago
Joined: 2013-02-17

I am a little confused. I new to programming and have been hung up on the String Function Challenge (21) "Display number of characters removed from string." I finally got it...after ignoring a few weird results. But I was still puzzled as to why my phrase or sentence did not display leading and trailing blank spaces even before I added the function TRIM?

$phrase = " this is my phrase ";
print $phrase;


this is my phrase

I felt it should display:

_ _ _ _ _ this is my phrase_ _ _ _ _ (the underscore indicates the spaces but would really print to the screen as indented)

Am I correct with this? If yes how do you print a phrase with leading and trailing spaces?

Thanks for any help.

Add to playlist

Add to , or

Add to new playlist:

Add to playlist
This is a member-only feature
But, it's easy to become a member

Add to cart:

Contact us

Below are the supported keyboard shortcuts for our video player.

Start / stop video
Go to next video
Go to previous video
Increase or decrease player speed by 20%
Skip ahead or go back by 15 seconds
Jump to a percentage (2 is 20%, for example)
Toggle full screen
Videos Pricing More Search
BuildAModule Logo Icon BuildAModule Logo Icon
Become a member!
1 month
6 months
10% off
12 months
20% off
All memberships come with the following:
24 / 7 access to the entire 1800+ video library
An innovative video player with a rolling transcript
Extensive Drupal and cross-platform training
A thorough and thoughtful training style
Progress tracking
Take notes on specific video sections
Intuitive multi-user management
How many users?
Go solo with a single user, or give multiple team members access through one account and get discounts by bundling multiple users into a single membership.