any one can help me out of this simple php code ?
Posted: Tue Mar 14, 2006 6:45 pm
I created two files,and I dont know what happend, function getType return an empty value; any one can give me a help?
my_type.php
-------------------------------------------
index.php
my_type.php
Code: Select all
<?php
class my_Type{
var $standard ='doc1';
function my_Type(){
$this->getType();
}
function getType(){
return $standard;
}
function setType($type_style){
switch (strtolower((string)$type_style)) {
case 'one':
$standard = 'doc1';
break;
case 'two':
$standard = 'doc2';
break;
default:
$standard = '';
break;
}
}
}
?>index.php
Code: Select all
<?php
require('my_type.php');
$web_type = new my_Type();
$web_type -> setType('strict');
echo $web_type -> getType();
?>