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? Quote 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"; Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/253125-object/#findComment-1297683 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.