Beginning PHP - Challenge help

No replies
JudiKins
Offline
Last seen: 5 years 37 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;

displayed:

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:


Loading...
Contact us

Below are the supported keyboard shortcuts for our video player.

space
Start / stop video
shift
Go to next video
shift
Go to previous video
Increase or decrease player speed by 20%
Skip ahead or go back by 15 seconds
1...9
Jump to a percentage (2 is 20%, for example)
f
Toggle full screen
Videos Pricing More Search
BuildAModule Logo Icon BuildAModule Logo Icon
Become a member!
$29
1 month
$156
6 months
10% off
$276
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?
user
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.