Earlier quoted context omitted.
> user comments Ha-ha-ha. You're kidding, right? Check strlen: http://www.php.net/manual/en/function.strlen.php Comments: 1. Comment about how PHP converts types. "Conclusion: The values are converted to string before check the lenght." 2. Comment from a novice user who posted a solution to the problem of subtracting the number of spaces in string from its length. 3. Comment about someone who thought that there was a…
It may just be a side effect of PHP's problems, but even the wrong comments tend to be extremely useful when you run into something weird when coding. Of course it's always more fun to bash people & programming languages, so maybe I'll just join in: that bloody Ruby API reference lacks any comments from users who might have noticed something that's causing a strange bug in my script.
I Like PHP
221–230 of 269 posts
Re: I Like PHP
#222PHP's greatest strength is that it doesn't require OO. Seriously, for most simple web application tasks (and even some complicated ones) OO adds more confusion than it removes, and I say this as someone who certainly sees the value in OO for complex apps. Most web apps are ultimately more like shell scripts or console applications than desktop/mobile applications. It's no coincidence that most of the former are writt…
A tricycles greatest strength is that it doesn't require balancing on two wheels. For those who can't ride a bicycle, tricycles are great. Once you understand how to use a framework/language like RoR, I don't see how PHP is more useful (unless you have size constraints). ActiveRecord::Base.connection.execute("SELECT foo from bar where x = y") is just as simple as mysql_query("SELECT foo FROM bar WHERE x = y"), and yo…
Re: I Like PHP
#223Earlier quoted context omitted.
Can you please provide me a resource to learn how to fully separate the code from the markup? I learned web development on ColdFusion then switched to PHP. I certainly understand separation of content from design (HTML to CSS) but I honestly have no idea how to do web development without mixing markup (HTML) with the actual programming. I've done a little C and Java web stuff where my code printed HTML output - ugly.…
Frameworks have been suggested, and are a good option. A good understanding of MVC will carry you through though, and if you are only building small things then an ad-hoc MVC set up will probably get you most of the way to readable, flexible, maintainable code. One good tool for separating code and HTML is using a templating engine of some sort, I adore Smarty and normally recommend it without hesitation, but have to…
Re: I Like PHP
#224Earlier quoted context omitted.
> That is NOT a result of the language. Considering PHP is more-or-less designed to be a templating language, I'd say it is. Partly. On the other hand, PHP is a pretty good templating language. People should just learn to separate business logic from presentation logic.
It is possible to write clean, well-factored code in PHP. Just as it is in other languages. That wasn't how the language was originally intended to be written, and that is not how hordes of people use it. But it can be done. Really.
This is very different from other languages such as ruby where templating uses the ERB module, which is a subset of the ruby language.
Re: I Like PHP
#225Earlier quoted context omitted.
None of the things you listed have anything to do with PHP, they can happen in any language.
Oh, absolutely! Except that they're more prevalent in PHP applications than anything else. It's simply way, way too easy to do the wrong thing. If you want to introduce XSS into, say, a Rails app, it's significantly more difficult; generally, you have to explicitly throw something back as 'raw'. Sure, some PHP frameworks handle it the same way, but it's rare to see this in the real world. While testing apps, PHP imme…
But by now I am mature enough to understand that if you hire bad programmers you get bad code irrespective of the language its written in. You can use any tool you want, if you use it badly the result is going to be bad. These are days of Python and Ruby fanboyism so very obviously everything is going to look ugly in front of it. Code bases in other languages will be declared legacy and the same thing will be translated to the new shiny language and called the 'modernized' code bases. Your RDBMS use cases will be shoe horned to NoSQL databases and declared designed for the web. This will go on and on for anther few years...
Until we get to see page long blog posts another few years from now describing how many bad Python + Django examples can be found on the net. Or how bad Python and Ruby Legacy codebases are. How framework dependency with Django, Rails or Twisted sucks. Or how someone had to spend huge engineering effort migrating from Python 2 series to 3 series. Or how they had to rewrite a large part of SQL logic to work with NoSQL databases.
This trend repeats every few years, every few years a set of tools get trolled badly.
Re: I Like PHP
#226Earlier quoted context omitted.
This is unfortunately true. I'm a PHP programmer (currently writing a book, A Highly Negative Book About PHP , that I've been billing as "like Essential Java but tells you what not to do") and, I like to think, a fairly good one; reading this article made me cringe because this guy is emblematic of most of the problems in the PHP community. He: -accepts uncritically gobs of code dredged up via Google -considers somet…
I'm convinced that this post is satire and the author has trolled us all. In fact, i reject any other explaination. Sticks fingers in ears . Lalalalala, it's satire, nobody is this incompetent. Lalalalala, can't hear you.
Re: I Like PHP
#227Earlier quoted context omitted.
This is unfortunately true. I'm a PHP programmer (currently writing a book, A Highly Negative Book About PHP , that I've been billing as "like Essential Java but tells you what not to do") and, I like to think, a fairly good one; reading this article made me cringe because this guy is emblematic of most of the problems in the PHP community. He: -accepts uncritically gobs of code dredged up via Google -considers somet…
I'm convinced that this post is satire and the author has trolled us all. In fact, i reject any other explaination. Sticks fingers in ears . Lalalalala, it's satire, nobody is this incompetent. Lalalalala, can't hear you.
Re: I Like PHP
#228Earlier quoted context omitted.
Perl does the same thing with type coercion, and "0" in Perl is false. However, the thing that Perl does that PHP doesn't is have different operators for strings and numbers. Don't get me wrong, I think conflating strings and numbers is a bad idea, but if you're going to conflate strings and numbers, then having separate operators is the right thing to do.
I am not very familiar with Perl. When you say different operators for strings and numbers are you referring to something similar to PHP's === operator for which "1"===true would be a false statement?
Re: I Like PHP
#229Earlier quoted context omitted.
Perl does the same thing with type coercion, and "0" in Perl is false. However, the thing that Perl does that PHP doesn't is have different operators for strings and numbers. Don't get me wrong, I think conflating strings and numbers is a bad idea, but if you're going to conflate strings and numbers, then having separate operators is the right thing to do.
I am not very familiar with Perl. When you say different operators for strings and numbers are you referring to something similar to PHP's === operator for which "1"===true would be a false statement?
"==" returns true if the left argument is numerically equal to the right argument.
"eq" returns true if the left argument is stringwise equal to the right argument.
see 'perldoc perlop' under the heading "Equality Operators"
Re: I Like PHP
#230Earlier quoted context omitted.
Python itself does, but the third party modules (which do most of the heavy lifting) generally don't. See: Twisted.
Perl is a good example where most third-party modules have good documentation. Or at least a SYNOPSIS you can poke, some DESCRIPTION of what the module does, and a few hundred lines of code in the t/ directory that test all the features of the modules. The one thing I miss in Python is the inability to click "view source" in my web browser to see how a core Python library is implemented. PHP also has this problem. (C…
The only thing I wish they had was a way to pipe it through a highlighter like perltidy with html out. That'd probably just lead to holy wars on formatting/colours though.