What do you know about the functions of php braces?
- /**
- * Php braces
- * Site http://bbs.it-home.org
- */
- $ Arr = array (0 => 123, 'name' => 'pipig ');
- Foreach ($ array as $ k => $ v ){
- Echo "select * from blog_blogs where blog_tags like '% {$ arr [$ k]} % 'Order by blog_id"; // add a braces that will only be used as a variable identifier
- }
- Echo'
';
- Foreach ($ array as $ k => $ v ){
- Echo "select * from blog_blogs where blog_tags like '% {$ arr [$ k]} % 'Order by blog_id"; // add two braces, the outer layer is a common character.
- }
- // Use braces to differentiate variables
- // Echo "$ arr ['name']"; // a syntax error is returned when you use this sentence.
- Echo "{$ arr ['name']}"; // This sentence is normal. the characters in braces are processed as variables.
- // $ Str {4} after the variable of the string, the variable of the string is treated as an array like the braces ({}).
- $ Str = 'abcdefg ';
- Echo $ str {4 };
- ?>
|