面向对象基础

<?php
/**
* Created by PhpStorm.
* User: Vvvvv
* Date: 2017/2/11
* Time: 8:36
*/
//$arr = array('x','y','z');

//$x = anshu($a,$b);
//list($a,$b,$c) = $arr;
//$arr[0];
//echo $a;
//echo key($arr);
//echo current($arr);
//next($arr);
//echo key($arr);
//echo current($arr);
class test_class
{
public $abc;//private私有变量 protect受保护的变量
public $a;
public $b;

function square()
{
return $this->a * $this->b;
}
}

$shili = new test_class();
$shili2 = new test_class();

$shili->a = 4;
$shili->b = 5;
$return = $shili->square();
//document.write()
//document->write()

var_dump($shili);
echo "<br>";
var_dump($shili2);
原文地址:https://www.cnblogs.com/jc535201285/p/6388786.html