renathy Posted October 7, 2010 Report Share Posted October 7, 2010 Vai iespējams uztaisīt foreach, kas izdrukātu gan public, gan protected properties vērtības (private nē). Un to panākt ar customo Iteratoru? Kāda būtu ideja, lai "izņemtu" privātos? R. Quote Link to comment Share on other sites More sharing options...
marrtins Posted October 7, 2010 Report Share Posted October 7, 2010 http://php.net/manual/en/book.reflection.php Quote Link to comment Share on other sites More sharing options...
renathy Posted October 7, 2010 Author Report Share Posted October 7, 2010 Ok, paldies. Skatīšos... Quote Link to comment Share on other sites More sharing options...
marcis Posted October 8, 2010 Report Share Posted October 8, 2010 Kaut kur iepriekš jau bija līdzīga tēma, bet man arī neizdevās viņu atrast. Teorētiski šim vajadzētu strādāt, bet es tik un tā iesaku Reflection klasi :) $obj = new ClassName(); foreach((array)$obj as $key=>$value){ if($key[0] == "\x00" && $key[1] != '*') continue; // private var_dump($value); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.