Advertisement
Guest User

Untitled

a guest
Sep 20th, 2014
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. class Table
  2. {
  3. public $pk;
  4. ...
  5. }
  6.  
  7. $Table=new Table();
  8.  
  9. $Table->pk='username'; //here I set what is PK column in my table
  10.  
  11. $Table->$pk='sbrbot'; //here I dynamically define variable and set $Table->username='sbrbot'
  12.  
  13. class Table
  14. {
  15. ...
  16. $pk=$this->pk;
  17. $value=$this->$pk;
  18. }
  19.  
  20. $value=${$this->pk}
  21.  
  22. class Table
  23. {
  24. public $username;
  25. ...
  26. }
  27.  
  28. $Table=new Table();
  29.  
  30. $pk='username'; //here I set what is PK column in my table
  31.  
  32. $Table->$pk='sbrbot'; //here I dynamically define variable and set $Table->username='sbrbot'
  33.  
  34. $value=${$this->pk}
  35.  
  36. $value = $this->{$this->pk};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement