07c00-1.php
来自「介绍PHP5的给类型函数应用」· PHP 代码 · 共 26 行
PHP
26 行
<?php// Define a simple class that simply echoes the value given it.class SimpleClass { public $data; public function echoMyData() { echo $this->data; }}// Create an object based on SimpleClass$sc_object = new SimpleClass();// Set a value for the data of the object$sc_object->data = "Hello, world! ";// Now let us create another object and give it a different value.$another_object = new SimpleClass();$another_object->data = "Goodbye, world! ";// Use the class method to print out the value of our two objects.$sc_object->echoMyData();$another_object->echoMyData();// The output from this script will be:// Hello, world! Goodbye, world!?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?