变量替换

1. 变量替换

<?php
$a1="1";
$a12="2"; 
echo "$a12<br>";
echo "{$a12}<br>";
echo "{$a1}2<br>";
?>

2.确定变量类型

<?php
$a1="1";
echo gettype($a1)."<br>";
$a1+=1;
echo gettype($a1)."<br>";
echo $a1."<br>";
$a1+=1.1;
echo gettype($a1)."<br>";
echo $a1."<br>";
$a1=(array)($a1);
echo $a1."<br>";
echo gettype($a1)."<br>";
settype($a1,"string");
echo $a1."<br>";
echo gettype($a1)."<br>";
?>

运行结果

string
integer
2
double
3.1
Array
array
Array
string

 

posted on 2013-10-18 17:50  php1994  阅读(261)  评论(0编辑  收藏  举报

导航