<?php
$type1 = true;
echo $type1, '<p>我爱php</p>';
echo gettype($type1);
$array = [1, '张三', 'java', '男'];
echo '<br><br><br><br>';
echo $array[0], '<br>';
echo $array[1], '<br>';
echo $array[2], '<br>';
echo $array[3], '<br>';
$array[] = 'php真难';
echo $array[4], '<br>';
$array[0] = '999';
echo $array[0], '<br>';
echo '<br><br><br><br>';
$stu = ['name' => '刘振华', 'sex' => '男', 'love' => '编程', 'age' => 21];
// echo $stu['name'] . '<br>', $stu['sex'] . '<br>', $stu['love'] . '<br>', $stu['age'];
echo 'name=', $stu['name'], '<br>';
echo 'sex=', $stu['sex'], '<br>';
echo 'love=', $stu['love'], '<br>';
echo 'age=', $stu['age'], '<br>';
class Demo
{
private $name = '刘振华';
private $age = 21;
public function stuInfo()
{
echo '我的名字是:', $this->name, ',今年', $this->age, '岁了';
}
}
$obj = new Demo();
echo $obj->stuInfo();