создание и продвижение сайта (вбиваю в ТОП-10, как гвозди)Настройка и сопровождение платной рекламы яндекс.директ

PHP. Руководство по PHP. 2005

Variable substitution in strings Пред.

Приложение C. Migrating from PHP 3 to PHP 4

След.

Variable substitution in strings

PHP 4 adds a new mechanism to variable substitution in

strings. You can now finally access object member variables and

elements from multidimensional arrays within strings.

To do so you have to enclose your variables with curly braces with

the dollar sign immediately following the opening brace:

{$...}

To embed the value of an object member variable into a string you

simply write "text {$obj->member} text" while

in PHP 3 you had to use something like "text

".$obj->member." text".

This should lead to more readable code, while it may break

existing scripts written for PHP 3. But you can easily check for

this kind of problem by checking for the character combination

{$ in your code and by replacing it with

\{$ with your favorite search-and-replace

tool.

Пред.

Начало

След.

PHP 3 extension

Уровень выше

Cookies

Отвечу на любые вопросы. С уважением, Дмитрий Владимирович.

Ваше письмо×
Free Web Hosting