Stefany93 Posted March 3, 2013 Share Posted March 3, 2013 (edited) Hello fellows, I have noticed that CodeIgniter has the "var" keyword in front of all of its predefined class properties like this: class CI_Session { var $sess_encrypt_cookie = FALSE; // more code here } I know that the "var" keyword was used back in PHP 4 to define a variable, but no one still uses PHP 4 anyways, so could you please tell me why the hell CodeIgniter still puts "var" in front of properties? Edited March 3, 2013 by Stefany93 Quote Link to comment Share on other sites More sharing options...
Jessica Posted March 3, 2013 Share Posted March 3, 2013 Wow, NO ONE uses PHP 4? I'd love to see how you came to that conclusion. There's a lot of hosts offering an option that NO ONE uses. Quote Link to comment Share on other sites More sharing options...
teynon Posted March 3, 2013 Share Posted March 3, 2013 This shows statistics of outward facing websites: http://w3techs.com/technologies/details/pl-php/all/all There are many inward facing (intranets) that still use PHP 4. My work FINALLY upgraded to 5.3. But they haven't pushed those changes out to customers yet. Quote Link to comment Share on other sites More sharing options...
johnsmith153 Posted March 3, 2013 Share Posted March 3, 2013 Basically, you are right that nobody uses it, or nobody codes in it if they have the choice, but of course as teynon pointed out some people have no choice and CodeIgniter have ensured they still support it for that reason. Of course Jessica doesn't always respond in such an unhelpful way. I see you were only asking a question. Quote Link to comment Share on other sites More sharing options...
teynon Posted March 3, 2013 Share Posted March 3, 2013 I'd say Jessica responded appropriately. The question was formed in a very heavy tone and very biased. Her comment was to the point. As for asking a question, I'd say this was formed more as a rant than a question. Quote Link to comment Share on other sites More sharing options...
johnsmith153 Posted March 3, 2013 Share Posted March 3, 2013 Remove the word 'hell' and it's one of the nicest worded questions I've seen. Quote Link to comment Share on other sites More sharing options...
Jessica Posted March 3, 2013 Share Posted March 3, 2013 So if we're going to rant about CI's conventions, has anyone ever read their "style guide"? http://ellislab.com/codeigniter/user-guide/general/styleguide.html#logical_operators "Use of || is discouraged as its clarity on some output devices is low (looking like the number 11 for instance)." One might argue that someone who confuses if($foo || $bar) and if($foo 11 $bar) might have enormous difficulty with the rest of the code as well. Really. foo 11 bar... come on. Quote Link to comment Share on other sites More sharing options...
Jessica Posted March 3, 2013 Share Posted March 3, 2013 Also, there's nothing that says you can't use var past PHP 4. The documentation simply says it will be treated the same as public. What's wrong with that? Quote Link to comment Share on other sites More sharing options...
teynon Posted March 3, 2013 Share Posted March 3, 2013 Remove the word 'hell' and it's one of the nicest worded questions I've seen. "You're not very smart." Remove the word not, and it's a pretty nice statement as well. Quote Link to comment Share on other sites More sharing options...
johnsmith153 Posted March 3, 2013 Share Posted March 3, 2013 "You're not very smart." Remove the word not, and it's a pretty nice statement as well. No, remove the word 'not' and your statement means the opposite. Remove the word 'hell' from the question in this topic and it means the same thing. You're removing a word to make a sentence mean the opposite, it's a poor example. Quote Link to comment Share on other sites More sharing options...
Jessica Posted March 3, 2013 Share Posted March 3, 2013 Alright guys enough. Quote Link to comment Share on other sites More sharing options...
salathe Posted March 4, 2013 Share Posted March 4, 2013 could you please tell me why the hell CodeIgniter still puts "var" in front of properties?Simply because no-one got around to updating those particular properties yet. There is nothing more to read into it than that. Quote Link to comment Share on other sites More sharing options...
sKunKbad Posted March 4, 2013 Share Posted March 4, 2013 CodeIgniter dropped support for PHP4 a while back, but nobody got around to updating the 2.1.X branch because they are focusing their efforts on v3. If you take a look at v3 on github you will see that the session class and the whole framework has been updated. No more var. I will use CodeIgniter 2.1.3, and the var doesn't hurt, even on PHP 5.4.X. It may not be the most elegant framework in the world, but it gets the job done. I don't think anyone is claiming CodeIgniter to be the best framework anymore, but 2.1.3 is stable, and I use it every day. I think in the future I'll be focusing on Slim, Laravel, and other frameworks. Quote Link to comment Share on other sites More sharing options...
Stefany93 Posted March 5, 2013 Author Share Posted March 5, 2013 Thank you very much for the replies, fellow programmers! I understand now that the only reason "var" isn't removed is because the CodeIgniter development team doesn't want to in order to help folks who are still running on PHP4 for some reason. Anyways, thank you. Quote Link to comment Share on other sites More sharing options...
salathe Posted March 5, 2013 Share Posted March 5, 2013 Thank you very much for the replies, fellow programmers! I understand now that the only reason "var" isn't removed is because the CodeIgniter development team doesn't want to in order to help folks who are still running on PHP4 for some reason.Did you even read the replies? The "var" is not being kept for PHP 4 compatibility, any version of CodeIgniter 2.0.0 or above requires PHP 5. Quote Link to comment Share on other sites More sharing options...
Hall of Famer Posted March 8, 2013 Share Posted March 8, 2013 I wouldnt say no one still uses PHP 4, but its definitely no need for any frameworks to compensate for PHP 4 users. They are minority nowadays, and PHP4 is not powerful enough to code most web applications. They are mostly for old applications written in the early days, no new softwares should be written with PHP 4 except in extremely rare cases when its the only available choice. 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.