Object of class Foo could not be converted to string in PHP -


Is there any normal solution that I can convert some arrays and objects into a string, Not just simple type?

Like (but only as a sample!)

  $ myVar1 = (string) $ myInt; $ MyVar2 = (string) $ myArray;  

For example, writing your work to do what you want To convert from string to string, you can use this function: implode (',', $ array); This function will return a string with this separator, with all the array being included in Elements.
You can write your own method (toastring) in Java to convert an object to a string)

  class user {Private $ name; Private $ age; Public function to string () {return $ this-> Name ''. $ This- & gt; Ages; }}  

Comments