php - Zend Framework view script, functions and variable scope -
I'm new to Zend Framework and am trying to understand it. In my visual script (index.phtml), I have this code that says: "; Print_r (this $); Echo "& lt; / pre & gt;"; $ String = ''; = "'. $ Element." ($ Empty-$ -> [$ element]) {$ string = $ string. & Lt; label class = "error"! '; Foreign currency ($- >-> ; Error [$ element] as $ error) {$ string = $ string. $ Error;} $ String = $ string. '& Lt; / label & gt;';} $ string return;} echo "& lt ; Pre & gt; "; print_r (this $); echo" & lt; / Pre> "getErrorString (" blah "); die (); It gives me: Fatal error: $ x When using the object X. on the index context in the object context, it seems that when you create a function within a scene, you lose $ $ this variable. I was searching around, and no one else could see me trying to get what I am doing (not very likely, maybe I'm looking for it...