OOP with PHP.
Posted: Mon Mar 30, 2009 1:14 am
G'day,
Though not new to php, i am exploring oop in php.
I've started to do some VERY basic testing with php classes, and have a return variable error.
<?php
class_lib.php
index.php
Upon testing these, i get an output of 0. Is this because the return value only returns int variables or is it because of my concanination?
thankyou,
weasel
Though not new to php, i am exploring oop in php.
I've started to do some VERY basic testing with php classes, and have a return variable error.
<?php
class_lib.php
Code: Select all
class drink {
//var $drinkNam;
//var $ingredientList;
var $drinkURL;
//var $blank;
function set_url($url){
$drinkURL = $url;
}
function get_url(){
return $this->drinkURL;
}
}
?>
Code: Select all
<html>
<head>
<title>Test Doc #1</title>
</head>
<?php include("class_lib.php"); ?>
<body>
<?php
$url = "Bloody Mary";
$d1 = new drink();
//$d1->set_url($url);
$drink1URL= $d1->get_url();
echo "Drink name: "+$drink1URL;
?>
</body>
</html>Upon testing these, i get an output of 0. Is this because the return value only returns int variables or is it because of my concanination?
thankyou,
weasel