PHP. Passing by reference
In this lesson we will discuss value of variables by reference (hard and symbolic links), and data types in php. I will write code in netbeans ide (integrated development environment).
Code lesson
<?php
/**
* PHP - язык с динамической типизацией
* Типы переменных
* Скалярные
* boolean (true/false (TRUE/FALSE));
* integer (10,100,-1600);
* float (10.4, -5.6);
* string ("test");
* Смешанные
* array - ($arr = (1,2,3,4));
* object - объект
* Специальные
* resource
* null
*/
$x = 20;
$y = &$c;
/*$x = $x + 2;
$y = $x;
echo "<br>";*/
echo "x ravno $x";
echo "<br>";
echo "y ravno $y";
echo "<br>";
unset($x);
unset($y);
echo "x ravno $x";
echo "<br>";
echo "y ravno $y";
echo "<br>";
$var = "100";
echo gettype($var);
$p = "var";
echo $$p;
echo "<br>";
echo "y ravno $y";
echo "<br>";
echo "c ravno $c";
echo "<br>";
echo gettype($y);
echo gettype($c);
echo "<br>";
echo "$d";
0 Comments