DonjonMaister@programming.dev to Programmer Humor@lemmy.ml · 3 years agoThe difference between an instance variable and a static variable.programming.devimagemessage-square9linkfedilinkarrow-up130arrow-down11file-textcross-posted to: programmer_humor@programming.dev
arrow-up129arrow-down1imageThe difference between an instance variable and a static variable.programming.devDonjonMaister@programming.dev to Programmer Humor@lemmy.ml · 3 years agomessage-square9linkfedilinkfile-textcross-posted to: programmer_humor@programming.dev
minus-squarefiahlinkfedilinkarrow-up3·3 years agoint variable => local scope => my int from the perspective of an instance static int variable => class scope => our int, for all instances of a class
minus-squareBear_with_a_hammer@lemmy.mlBannedlinkfedilinkarrow-up1·3 years agoYou know what’s funny? In PHP it’s backwards :D
int variable => local scope => my int from the perspective of an instance
static int variable => class scope => our int, for all instances of a class
You know what’s funny? In PHP it’s backwards :D
well of course it is!