Passing an array of data to a private function in CodeIgniter/PHP? [facepalm] -


So I thought that it should be easy, but I'm here failed'm Anaksbiai and epic (as That they say interwebs).

So here's my code:

  function xy () {$ array ['var1'] = x; $ Array ['var2'] = y; Sampling $ this- & gt; _z; } Function _z ($ array) {$ xy = $ x $ Y; Return $ xy; }  

So, it seems that the simple code does not work? I know that you can pass the array and the variable can only be accessed in the scene with their array title, but why does not it work in this case?

jack

Because function _z is not visible It has $ this- & gt; _z ($ array); Call with . In addition, the variables that are seen and received by code ignators are also seen. It does not work in a similar manner for non-ideas, PHP will not do it for you automatically.

To load a view, create a visual file in / system / application / views / and copy it to $ this-

< P> I write my work as follows:

  function xy () {$ X = "some value"; $ Y = "some other values"; Copy $ this- & gt; _z ($ x, $ y); } Function _z ($ a, $ b) {return $ a. $ B; }  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -