figmented Posted September 11, 2008 Share Posted September 11, 2008 I need to point a variable to a class using the scope resolution operator. I use the following to point a var to a class using the method operator: $className = 'Users'; $className->getAll(); This works but when I try: $className = 'Users'; $className::getAll(); ...I get the Hebrew error "unexpected T_PAAMAYIM_NEKUDOTAYIM" which means "unexpected double colon" Does anyone know how to do this and/or if this is possible? Thanks! Best, Christopher Tate www.figmented.com Link to comment https://forums.phpfreaks.com/topic/123830-how-to-point-var-to-class-like-this-classnamegettracksandartists/ Share on other sites More sharing options...
448191 Posted September 11, 2008 Share Posted September 11, 2008 No ALL CAPS. I'll change it this time, but next time I'll just lock it. To answer your question, only way this is possible is with call_user_func or call_user_func_array (or Reflection, but lets not complicate matters). Link to comment https://forums.phpfreaks.com/topic/123830-how-to-point-var-to-class-like-this-classnamegettracksandartists/#findComment-639352 Share on other sites More sharing options...
figmented Posted September 11, 2008 Author Share Posted September 11, 2008 sorry about that. this function worked perfectly. thank you so much! Link to comment https://forums.phpfreaks.com/topic/123830-how-to-point-var-to-class-like-this-classnamegettracksandartists/#findComment-639361 Share on other sites More sharing options...
448191 Posted September 11, 2008 Share Posted September 11, 2008 You're welcome. Link to comment https://forums.phpfreaks.com/topic/123830-how-to-point-var-to-class-like-this-classnamegettracksandartists/#findComment-639363 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.