Tuesday, May 29, 2018

PHP string not concatonating











I'm getting the following error:




Parse error: syntax error, unexpected '.', expecting ',' or ';' in xxx
on line 19





On this line:



public $metad_name = "lol" . "lol";

Answer



This error is saying that an expression can't be used in class properties:



Works



class Foo {


public $metad_name = '';

function __construct() {
$this->metad_name = 'lol' . 'lol';
}

}



Parse error



class Bar {

public $metad_name = 'lol' . 'lol';

}


If your code isn't a class property - just delete the public



No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...