04c05-2.php

来自「介绍PHP5的给类型函数应用」· PHP 代码 · 共 19 行

PHP
19
字号
<?php// Create a couple variables$favorite_color = 'blue';$favorite_weapon = 'crossbow';$favorite_drink = 'bourbon';// Make an array of these variable names$favorite_things = array('color', 'weapon', 'drink');// Now access all these variables programmatically via variable variables// This will output:// color = blue// weapon = crossbow// drink = bourbonforeach ($favorite_things as $thing) {    echo '<p>', $thing, ' = ', ${"favorite_{$thing}"}, '</p>';}?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?