Add a variable to a class instance at runtime: Difference between revisions
Content deleted Content added
m Added to <5 category |
No edit summary |
||
Line 20: | Line 20: | ||
# Set runtime variable (key => value). |
# Set runtime variable (key => value). |
||
$o->{'foo'} = 1; |
$o->{'foo'} = 1; |
||
=={{header|PHP}}== |
|||
class C |
|||
{ |
|||
} |
|||
$MyC=new C(); |
|||
$MyC->v="yes, here i am"; |
|||
echo $MyC->v; |
|||
=={{header|Python}}== |
=={{header|Python}}== |