DarkMantis Posted November 1, 2010 Share Posted November 1, 2010 Hi all, Recently I've been doing some work with C++, and I've been learning about it's struct keyword. I've never come across it in PHP but I was just wondering whether there would be such a thing in it? ie: struct point{ int x; int y; } POINTS; Many Thanks! Link to comment https://forums.phpfreaks.com/topic/217452-struct-in-php/ Share on other sites More sharing options...
Lautarox Posted November 1, 2010 Share Posted November 1, 2010 You could create a class to use as a struct. Link to comment https://forums.phpfreaks.com/topic/217452-struct-in-php/#findComment-1128964 Share on other sites More sharing options...
DarkMantis Posted November 1, 2010 Author Share Posted November 1, 2010 It's not the fact that I want to use it neccessarily, I was just wondering as I've never seen it in PHP before. BUT, that is an awesome Idea, I think I will! Thanks! Link to comment https://forums.phpfreaks.com/topic/217452-struct-in-php/#findComment-1128965 Share on other sites More sharing options...
akaweed Posted November 1, 2010 Share Posted November 1, 2010 A php array is equivalent to a C structure. php arrays are not defined by intrinsic types, and are addressable by keys, which are the main reasons to use structures in C. Just my opinion... Link to comment https://forums.phpfreaks.com/topic/217452-struct-in-php/#findComment-1129175 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.