Earlier quoted context omitted.
I was thinking more of: #include int main() { int arr[10] = {1,2,3,4,5,6,7,8,9,0}, *ptr; for(int i = 10; i>=0; i--) { ptr = &arr[i]; printf("%d\n", *ptr); } printf("%d\n", *ptr); }
Sure, but you defined ptr outside of the loop. Who defined $object outside of the loop in the PHP example? Also note that, in C, you have to explicitly dereference pointers: ptr = 42; You should get a warning from your compiler if you try that. PHP effectively goes ahead and changes it to: *ptr = 42; Perl requires you to explicitly dereference references as well: @array = ('c', 'c++', 'java', 'perl'); $item = \$array…
PHP: The Right Way
131–140 of 233 posts
Re: PHP: The Right Way
#132Re: PHP: The Right Way
#133Earlier quoted context omitted.
We get it, man. PHP sucks, you're cool/smarter/better because you use something else, and you need to remind us all about it by jumping in every time the letters P-H-P are seen in sequence to let us all know how it sucks by retreading the same old lines used by the last fifty guys who said the same thing but to your credit you really tried to be clever about it. A good portion of why people like to mock PHP is due to…
> A good portion of why people like to mock PHP is due to the way people end up using the language rather than the language's ugly parts. Are you really going to trot out that old lie? Why not read this, instead? http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de...
E-fuckin-nough! It's beyond irrelevant. It's trolling. No one has anything more to add on the discussion of php as a language. I know this because in the past 3 weeks there have been literally thousands of comments about it and at this point its all a bunch of repeats. You have to be living under a rock if you haven't seen this same "php suck. No it doesn't, it's awesome" discussion a billion times before. Get off it already.
Phptherightway.com is the topic at hand. It's awesome. I wish I had something like it when I learned php. Oh, and I use php. All the time. I'm not ashamed because I don't feel like I need to get into a dick measuring contest over my l337 skillz or whatever it is that gets people acting so snobby about php.
Re: PHP: The Right Way
#134curl -s http://getcomposer.org/installer | php is creepy. Never ever run other people's code without at least giving it a glance.
RVM's installation is similar: https://rvm.io/rvm/install/ A far cry from the safer/verified "download this and check it's MD5 checksum" method that I'd prefer. Seriously, fixing package management so we can continuously integrate arbitrary code would be great. Getting arbitrary OS package creation to be almost as easy as pushing code to GitHub seems like a very worthy goal.
Re: PHP: The Right Way
#135Something to consider mentioning - there are some in PHP these days that take this sort of stuff a bit too far. Drives me nuts to see people writing classes to encapsulate a 3 column database result. So much overhead and boilerplate.
You should check out Java sometime.
I've seen this happening in C, followed by C++, and now Java and C#.
They will do it regardless of the language being used.
Re: PHP: The Right Way
#136The comments about namespace are somehow ironic: is it very common to find developers that know what classes are but not namespaces? The namespace concept is much simpler than class. Which makes me wonder: who is the target audience?
Re: PHP: The Right Way
#137curl -s http://getcomposer.org/installer | php is creepy. Never ever run other people's code without at least giving it a glance.
Yeah... only idiots "sudo aptitude install" without reading and building from source first!
Mr. Cantor, I have added to the list of people to never hire I keep in my notebook.
Re: PHP: The Right Way
#138I'm wondering why a specific code style is 'enforced' while it has nothing to do with interoperability. Libraries with different code styles can be used together without problems. It seems like they are using the PSR to declare they're own style as superior.
PSRs where decided based on the most common standards used by some of the biggest PHP projects around. It wasn't a single person setting a standard. PSRs are completely optional. However, you miss the point. The point of this isn't really to define all the options. Rather, it's to spell out best practices (and PSR-0 is really a best practice, and all about interoperability) that the community generally agrees with. B…
The whole concept of PSR-0 is ridiculous anyway, because PHP supports registering multiple class loaders. If a project wants to use a naming convention that won't work with standard spl_autoload(), they can register their own autoloader.
Re: PHP: The Right Way
#139Earlier quoted context omitted.
They do. http://www.joelonsoftware.com/items/2006/08/01.html http://skilldrick.co.uk/2010/09/why-javascript-is-awesome/
Javascript is just Scheme with a C-like syntax and a limited number of bad design decisions (like automatic semicolon insertion and the == operator). PHP is a never-ending fountain of bad design decisions, because its core devs continue to make new ones.
Re: PHP: The Right Way
#140Earlier quoted context omitted.
I was thinking more of: #include int main() { int arr[10] = {1,2,3,4,5,6,7,8,9,0}, *ptr; for(int i = 10; i>=0; i--) { ptr = &arr[i]; printf("%d\n", *ptr); } printf("%d\n", *ptr); }
Sure, but you defined ptr outside of the loop. Who defined $object outside of the loop in the PHP example? Also note that, in C, you have to explicitly dereference pointers: ptr = 42; You should get a warning from your compiler if you try that. PHP effectively goes ahead and changes it to: *ptr = 42; Perl requires you to explicitly dereference references as well: @array = ('c', 'c++', 'java', 'perl'); $item = \$array…