php - Parse error when concat'ing a defined variable and string in a class -


I defined a variable in a different configuration file:

  define (' URL ',' Someurl.co.uk ');  

However, when I try to use it to insert it inside the class with the string:

  class extends AdminEmail email {Private $ = "jsmith" .url;  

I get the following error:

  Parse error: parse error, '', '' or ''; '' ' 

But if I resonate it, it is completely displayed!

Hope I have not clarified anything!

You can not use static, functions or other variables while pre-defined square variables. Class definitions are like blueprints, they should be completely independent of anything running in the script (except on dependence on other sections of the course.)

You have to set it up later, e.g. In the manufacturer:

  class extends AdminEmail email {Private $ from; Function __construct () {$ this-> = "jsmith" .URL; }  

or in a separate function:

  function setform ($ from) {$ this- & gt; From = $ to; }  

Comments