Unlock your potential with a Pro Membership
Here is where you propel your career forward. Come join us today. Learn more.
Embedding Variables in a String
Lab: PHP String Building and Processing Basics
Video Runtime: 15:16
PHP provides the means for us to build dynamic strings, i.e. strings that have varying strings within them. One method is to embed a variable directly into the string.
When PHP comes to a single quote, it handles the string within the quotes as a string literal. There is no processing that happens. Rather, it treats it as a hard-coded string. Therefore, if you wrote echo 'My name is {$first_name}.'
, the entire string would be rendered out to the browser just as you wrote it. The variable would not be processed.
You will grow in this profession when you incrementally and systematically stretch yourself....bit-by-bit.
Episodes
Total Lab Runtime: 02:50:33
- 1 Lab Introductionfree 09:39
- 2 Embedding Variables in a Stringpro 15:16
- 3 Embedding Complex Variablespro 13:37
- 4 Concatenating Strings with a Dotpro 08:47
- 5 Concatenating and Assigning Shorthandpro 05:58
- 6 Formatting a String using Placeholderspro 15:16
- 7 Specifying Which Argument in a Formatted Stringpro 04:18
- 8 Has Substringpro 21:47
- 9 Replacing Substringspro 13:03
- 10 Get the String's Lengthpro 14:11
- 11 Character Set Encoding - It Matters!pro 11:42
- 12 Has Substring - for UTF-8pro 16:45
- 13 Replacing a UTF-8 Substringpro 05:56
- 14 Stripping out Characters or Entitiespro 10:51
- 15 Wrap it Upfree 03:27