Earlier quoted context omitted.
Here is some PHP code: $x = "0"; if(!$x){ echo "0 is false"; } If you understand why it's crazy that PHP prints "0 is false" when you execute that, you're probably better off jumping ship now. If you don't, you'll probably appreciate the low barrier to entry for PHP more than any benefit you'd gain.
I understand the standpoint of people thinking it's crazy. But javascript does the same thing, does it not? I thought this is what the triple equals is for?
I Like PHP
141–150 of 269 posts
Re: I Like PHP
#142Earlier quoted context omitted.
Python's got excellent documentation, both official and third party.
Python itself does, but the third party modules (which do most of the heavy lifting) generally don't. See: Twisted.
http://twistedmatrix.com/documents/current/api/twisted.html
http://twistedmatrix.com/documents/current/core/howto/index....
http://twistedmatrix.com/trac/wiki/Documentation
It's not as comprehensive and shiny as the core Python docs, but along with the tutorials and examples, it's actually pretty decent.
Re: I Like PHP
#143Earlier quoted context omitted.
Do yourself a favor. Never ever use wordpress as an example of a quality PHP application. Please look at the source code, the open source wordpress is a monstrous hack that has no clear architecture, has a terrible system of hooks that plugin authors regularly abuse and doesn't scale unless you write your own hack of plugin to override the db handler so you can do things like r/w splitting or sharding.
Any suggestions for PHP applications whose source code can be presented as an example of what TO do instead of what NOT to do?
http://flow3.typo3.org/download/ This is still in alpha but has good source code regardless.
Re: I Like PHP
#144Earlier quoted context omitted.
Do yourself a favor. Never ever use wordpress as an example of a quality PHP application. Please look at the source code, the open source wordpress is a monstrous hack that has no clear architecture, has a terrible system of hooks that plugin authors regularly abuse and doesn't scale unless you write your own hack of plugin to override the db handler so you can do things like r/w splitting or sharding.
Any suggestions for PHP applications whose source code can be presented as an example of what TO do instead of what NOT to do?
Re: I Like PHP
#145Earlier quoted context omitted.
I don't think you really mean "object orientation" so much as "a byzantine object hierarchy" (stereotypically associated with Java, of course). To me, Ruby's object-oriented string functions are a lot easier to keep track of than PHP's: x.length vs strlen($x) x.gsub('foo', 'bar') vs str_replace('foo', 'bar', $x) x.strip vs trim($x) x.upcase vs strtoupper($x) All four of the PHP functions use a different form: strX, s…
Python takes a different tactic, and has a non-object-oriented len() method What do you mean? In Python len() is just a standard protocol for getting the length of something, but len() itself is calling obj.__len__() if it is defined. You can even override or replace it in an object instance, returning whatever you want. You can argue that these protocols are a bad idea, or maybe a useless one since Ruby does just fi…
I guess this is another example of why using the term "object-oriented" at all can be unhelpful, as it may mean so many different things to different people depending on the particular situation.
Re: I Like PHP
#146There's a regular stream of "defending PHP" posts but they all seem to miss the point. No one bashes PHP because it can't do these things, or that it isn't easy. People bash PHP because there are objectively better languages and platforms out there and objectively bad decisions made by those guiding the PHP language. If you want to defend PHP in any meaningful way then you can't just list things that can be done easi…
> If you want to defend PHP in any meaningful way then you can't just list things that can be done easily in almost every semi-modern web ecosystem Did you ever read Python's documentation? Or Ruby's? Or Java's? Show me one popular web programming language which has a full page, up to date, with examples and user comments and version incompatibility info, per function . Of course, it's just one point and I otherwise…
Re: I Like PHP
#147Earlier quoted context omitted.
Don't forget being able to do this from within the interpreter: >>> print abs.__doc__ abs(number) -> number Return the absolute value of the argument. >>> print xrange.__doc__ xrange([start,] stop[, step]) -> xrange object Like range(), but instead of returning a list, returns an object that generates the numbers in the range on demand. For looping, this is slightly faster than range() and more memory efficient.
Or from ipython, even better: In [1]: abs? Type: builtin_function_or_method Base Class: String Form: Namespace: Python builtin Docstring: abs(number) -> number Return the absolute value of the argument.
In [1]: import json
In [2]: json.dumps??
Type: function
Base Class:
String Form:
Namespace: Interactive
File: /usr/local/Cellar/python/2.7.2/lib/python2.7/json/__init__.py
Definition: json.dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, encoding='utf-8', default=None, **kw)
Source:
def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True,
allow_nan=True, cls=None, indent=None, separators=None,
encoding='utf-8', default=None, **kw):
""" [snip (excellent) docstring] """
# cached encoder
if (not skipkeys and ensure_ascii and
check_circular and allow_nan and
cls is None and indent is None and separators is None and
encoding == 'utf-8' and default is None and not kw):
return _default_encoder.encode(obj)
#snip rest of funcRe: I Like PHP
#148One of the reasons I like PHP is that it still lets you get to a lower level of coding. Many of the newer languages and frameworks that have become popular in the past couple of years abstract things such as database connectivity away (Django is a good example of this) and it makes it difficult to optimize queries effectively without hacking onto the framework.
Wow, It's pretty apparent that there are a lot of young programmers here on HN. I was just stating my opinion and I got downvoted because I talked bad about your precious frameworks.
Re: I Like PHP
#149Earlier quoted context omitted.
In production, or just your dev environment?
You technically can compile ASP pages on the fly in production but it's bad practice, just like making changes directly to production is bad practice. The whole blog post is pretty much a great write up of how not to manage a website.
Re: I Like PHP
#150Earlier quoted context omitted.
> If you want to defend PHP in any meaningful way then you can't just list things that can be done easily in almost every semi-modern web ecosystem Did you ever read Python's documentation? Or Ruby's? Or Java's? Show me one popular web programming language which has a full page, up to date, with examples and user comments and version incompatibility info, per function . Of course, it's just one point and I otherwise…
Everyone is mentioning Python, but also check C# and .NET Fx and ASP.NET MVC. For example: http://msdn.microsoft.com/en-us/library/w4hkze5k.aspx or http://msdn.microsoft.com/en-us/library/system.object.member... You get the syntax (including VB, C++, and F# where availalbe), remarks, examples, version information, platforms, comments, and related content.
I mean, just look at that first URL!