Virtual Attribute - Acting Like String Is A Constant

I’m not sure if this is a PHP or a Yii problem, and there is almost certainly something terrible simple that I’m overlooking, but it’s got me stumped. Basically, I’ve got a getter for a virtual attribute like this:

public function getMultipatternvalue() {

			if ($this->multi_pattern == 0) {

				$val = "No";

			} else {

				$val = "Yes";


			return $val;


$this->multi_pattern is a (MySQL) tinyint being used as a Boolean. That seems fairly straightforward. Yet, when I try to use it, PHP returns: Use of undefined constant Yes - assumed ‘Yes’. I’ve tried it with single quotes and with double quotes; both produce the same error. It’s like the system isn’t seeing the quotes around the text string. I’ve had the same problem with attempting to concatenate dimensions like this:

public function getDimensions() {

			return number_format($this->width, 1) . 'in. W x ' . number_format($this->height, 1) . 'in. H';


(width and height are floats, hence the use of number_format.) This produces the same problem with attempting to deal with strings in quotes as if they were constants.

By the way, I also tried this getter like this:

public function getDimensions() {

			$format = '%f W x %f H';

			return sprintf($format, $this->width, $this->height);


That returned a similar error message: Parse error: syntax error, unexpected ‘W’ (T_STRING) in L:\xampp\yii\framework\base\CComponent.php(612) : eval()'d code on line 1

Does anyone have any idea what I’m doing wrong or how to fix this?