How do I use a variable within an extended class public variable

Posted by Gerry Humphrey on Stack Overflow See other posts from Stack Overflow or by Gerry Humphrey
Published on 2012-04-04T05:24:28Z Indexed on 2012/04/04 5:29 UTC
Read the original article Hit count: 267

Filed under:
|
|
|

Have a class that I am using, I am overriding variables in the class to change them to what values I need, but I also not sure if or how to handle an issue. I need to add a key that is generated to each of this URLs before the class calls them. I cannot modify the class file itself.

use Theme/Ride

class ETicket extends Ride {

  public $key='US20120303'; // Not in original class
  public $accessURL1 = 'http://domain.com/keycheck.php?key='.$key;
  public $accessURL2 = 'http://domain.com/keycheck.php?key='.$key;

}

I understand that you cannot use a variable in the setting of the public class variables. Just not sure what would be the way to actually do something like this in the proper format.

My OOP skills are weak. I admit it. So if someone has a suggestion on where I could read up on it and get a clue, it would be appreciated as well. I guess I need OOP for Dummies. =/

© Stack Overflow or respective owner

Related posts about php

Related posts about oop