$var 这是一个正常的变量,可以存储任何值(string/int/float等等)
$$var 这是一个引用变量,存储$var的值
$$$var 存储$$var的值 
 
代码如下:
 1 <?php
2 $a="abc";
3 $$a=100;
4 echo $a."<br>";
5 echo $$a."<br>";
6 echo $abc;
7
8 $x="U.P";
9 $$x="Lucknow";
10 echo $x."<br>";
11 echo $$x."<br>";
12 echo "Capital of $x is ".$$x;//当存在点.时,不能直接使用内容作为变量值
13
14 ?>

结果显示:

另一种写法:

 1 <?php
2 $name="Cat";
3 ${$name}="Dog";
4 ${${$name}}="Monkey";
5
6 echo $name."<br>";//Cat
7 echo ${$name}."<br>";//Dog
8 echo $Cat."<br>";//Dog
9 echo ${${$name}}."<br>";//Monkey
10 echo $Dog."<br>";//Monkey

结果显示:

随机推荐

  1. WPF Animation For SizeChanged Of UIElement

    效果图 学到一个新词: Show me the money 背景 这几天查资料,看到 CodeProject 上面的一篇 Post <Advanced Custom TreeView Layou ...

  2. Dapr微服务应用开发系列2:Hello World与SDK初接触

    题记:上篇介绍了Dapr的环境配置,这次我们来动手尝试一下Dapr应用的开发 Hello World Dapr应用的Hello World其实和其他的Hello World一样简单: 首先用你喜欢的语 ...

  3. KEIL5 使用STM32 官方例程

    1. 安装keil5,破解 网上很多安装包/教程,跳过 2.下载官方固件库 https://www.st.com/content/st_com/en.html 在这里找微处理器,STM32 stand ...

  4. linux内核编程入门--系统调用监控文件访问

    参考的资料: hello world   https://www.cnblogs.com/bitor/p/9608725.html linux内核监控模块--系统调用的截获  https://www. ...

  5. Commons Collections2分析

    0x01.POC分析 //创建一个CtClass对象的容器 ClassPool classPool=ClassPool.getDefault(); //添加AbstractTranslet的搜索路径 ...

  6. prototype chain & prototype & __proto__

    prototype chain & prototype & proto prototype chain MDN https://developer.mozilla.org/en-US/ ...

  7. windows 10 remote desktop

    windows 10 remote desktop https://support.microsoft.com/en-us/help/4028379/windows-10-how-to-use-rem ...

  8. c++ winapi 让目标程序(target)调用当前程序(local)的函数

    GameCheat 如果你的目标程序是x86/x64, 那么当前程序也需要编译为x84/x64 #include <iostream> #include <string> #i ...

  9. Nodejs 使用 TypeScript

    安装依赖 λ yarn add typescript types/node concurrently nodemon wait-on -D 初始化一个 tsconfig.json λ ./node_m ...

  10. C++ 中的智能指针-基础

    简介 在现代 C++ 编程中,标准库包含了智能指针(Smart pointers). 智能指针用来确保程序不会出现内存和资源的泄漏,并且是"异常安全"(exception-safe ...