面向对象基础

<?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);
posted @ 2017-02-11 10:43  周全264  阅读(218)  评论(0编辑  收藏  举报