六月 10, 2009
Packages to be installed before compile Apache 2.2.11 on Fedora 11
You need to install these packages with YUM first:
- yum install gcc gcc-c++
- yum install openssl openssl-devel
- yum install expat expat-devel
四月 11, 2009
Experiment: Pass by Reference in PHP, part 3
Code:
<?php
class Label {
var $text;
function Label($text) {
$this->text = $text;
}
}
$foo = new Label("foo");
$bar["foo"] = &$foo;
unset($foo);
var_dump($foo); print "<br/>\n";
var_dump($bar);
?>
四月 11, 2009
Experiment: Pass by Reference in PHP, part 2
Code:
<?php
class testObj {
private $flag=FALSE;
public function set_flag() {
$this->flag = TRUE;
}
public function get_flag() {
return $this->flag;
}
}
function test_container() {
static $_test_obj;
if (!isset($_test_obj)) $_test_obj = new testObj();
return array(&$_test_obj);
}
$array = test_container();
$test_obj_1 = $array[0];
$array = test_container();
$test_obj_2 = $array[0];
print sprintf("<li>object 1, before set flag: %s</li>\n",
var_export($test_obj_1->get_flag(), TRUE));?>
四月 11, 2009
Experiment: Pass by Reference in PHP
Code:
<?php
class testObj {
private $equals_inside=FALSE;
public function set_equals_inside() {
$this->equals_inside = TRUE;
}
public function equals_inside() {
return $this->equals_inside;
}
}
class testHandler {
private $test_obj_inside;
public function __construct($test_input) {
$this->test_obj_inside = $test_input[0];
}
public function test_equals_inside() {
return $this->test_obj_inside->equals_inside();
}
public function test_set_equals_inside() {
$this->test_obj_inside->set_equals_inside();
}
}
?>