Copy link to clipboard
Copied
HI I was wondering if Dreamweaver supports PHP namespaces? I've tested the following code in Dreamweaver CS4 it tells me I have an error in my code (even though it executes flawlessly on the server).
person.php
<?php
namespace pandemicode;
class Person {
public $name;
public $age;
public $height;
public $weight;
public function __construct($n, $a, $h, $w) {
$this->name = $n;
$this->age = $a;
$this->height = $h;
$this->weight = $w;
print "Creating " . $this->name . "\n";
}
public function __toString() {
return "name: " . $this->name . "\nage: " . $this->age . "\nheight: " . $this->height . "\nweight: " + $this->weight;
}
public function __destruct() {
print "Destroying " . $this->name . "\n";
}
}
?>
index.php
<?php
require_once("src/com/pandemicode/person.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SPRY Test</title>
</head>
<body>
<?php
$obj = new pandemicode\Person("Mike", 28, "6'0\"", "180lbs");
print $obj->age;
?>
</body>
</html>
Anyone run into issues using namespaces in PHP?
Thanks!
Copy link to clipboard
Copied
Hi
CS4 does not recognize namespaces.
PZ
Find more inspiration, events, and resources on the new Adobe Community
Explore Now