slarson8821 Posted December 14, 2011 Share Posted December 14, 2011 Why can't you do: x = new Object(); x.2 = "1"; But you can do: x = new Object(); x.ID_2 = "1"; Why can't you start a property with a number? Link to comment https://forums.phpfreaks.com/topic/253125-object/ Share on other sites More sharing options...
requinix Posted December 14, 2011 Share Posted December 14, 2011 Because properties (and variable names) can't start with a number. It's a syntax thing. You can, however x[2] = "1"; Link to comment https://forums.phpfreaks.com/topic/253125-object/#findComment-1297680 Share on other sites More sharing options...
slarson8821 Posted December 14, 2011 Author Share Posted December 14, 2011 Thanks Link to comment https://forums.phpfreaks.com/topic/253125-object/#findComment-1297683 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.