Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Karmen Philip
Karmen Philip
11,046 Points

I don't undestand the last 3 escape of the list .

I can't understand what this 3 means. Can somebody explain to me how can i undestand deeply how they work and how can I put this in practice. 1.

[0-7]{1,3} the sequence of characters matching the regular expression is a character in octal notation, which silently overflows to fit in a byte (e.g. "\400" === "\000") 2.

\x[0-9A-Fa-f]{1,2} the sequence of characters matching the regular expression is a character in hexadecimal notation 3.

\u{[0-9A-Fa-f]+} the sequence of characters matching the regular expression is a Unicode codepoint, which will be output to the string as that codepoint's UTF-8 representation (added in PHP 7.0.0)

I was intrigued by this question and did a quick search, but came up empty. What I gather is that you are dealing with string manipulation and that the <code> would be useful for inputting Unicode/ASCII. I would, however, like to share this Stackoverflow Article with you with the hope that it sheds some insight!

Karmen Philip
Karmen Philip
11,046 Points

I already look for the answer on google...and read some article but I don't understand too much. I try to use the escape and when I run the program it actually write the character that correspond to that number. but if is so why is call an escape ? If it treat the number like a character. what I really can understand is why everything is exactly the opposite . when i put an escape to a special character like \" it is take like it is . but when i try to this escape mode is not escape but an interpreter.

1 Answer

I only use the escape for white space or line-break. Please keep me informed if you learn something new!