Questions about PHP, a widely-used general-purpose scripting language that is especially suited for Web development.

learn more… | top users | synonyms

8
votes
6answers
697 views

How do I make web-application development less frustrating?

I am fairly new to web-application development. I just can't shake the feeling that it takes me forever to do anything of even remote complexity. In c++ and java I could write the same applications ...
8
votes
1answer
1k views

How to document an algorithm properly with sample data?

I am wondering what should an algorithm documentation contain? Can't locate a proper guideline to follow. I have in mind to include summary of the algorithm description of the algorithm flowcharts ...
8
votes
3answers
2k views

What is the difference (if any) between (null != $object) and ($object != null) when using PHP?

I am used to Java and therefore always think conditions are interpreted from left to right, i.e. there is a vital difference in null != $obj and $obj != null Now this seems not to be the case with ...
8
votes
3answers
868 views

How to properly validate your code?

I have about 4000 lines of code for a web-application in JavaScript / PHP / CSS / HTML. How can I test it properly? I only support the latest version of IE and Safari. I've worked out all the bugs. ...
8
votes
2answers
3k views

Is mod_security a good thing?

I've recently been frequented by erroneous error messages from mod_security. Its filter sets cover outdated PHP exploits, and I have to rewrite my stuff because Wordpress&Co had bugs years ago. ...
8
votes
7answers
6k views

PHP framework most similar to ASP.NET MVC3? [closed]

I've done a bit of work with CodeIgniter and a lot with straight PHP... I had the opportunity to use asp.net mvc3 recently and was absolutely blown away with my productivity. Despite not "knowing" ...
7
votes
7answers
960 views

What am I missing about PHP? [closed]

It's like this mythical thing that a dominating portion of developers say is just the best option for back-end development, a part of development about which I know virtually nothing beyond the ...
7
votes
6answers
1k views

What are the reasons that make PHP more popular for freelancing world?

In many freelancing websites, you see many job ads for PHP (backed by MySQL). However, job ads for .NET, Java, Ruby, etc. are not that much. What are the reasons which make PHP so popular for ...
7
votes
6answers
3k views

Do variable names affect the performance of websites?

Do variable names affect website performance? I know this will going to be very low number, but still can any one provide the reasons for not choosing a long variable name in aspect of performance?
7
votes
9answers
3k views

Does it make sense to avoid a framework when building a large webapp with PHP?

Being a PHP web application developer for several years now, I've had my share of MVCs and frameworks. At first I thought they were the best thing since sliced bread; everything seemed to be very easy ...
7
votes
3answers
2k views

Why was GOTO included in PHP 5? [closed]

I discovered some time ago that the GOTO control keyword was introduced in PHP 5.3.0. http://php.net/manual/en/control-structures.goto.php Why did it happen? What are the language design goals ...
7
votes
9answers
7k views

How to become an expert in Python, PHP and Javascript? [closed]

So I've been programming for about 9ish months now, and I've taught myself some Python, some PHP and some Javascript. I want to become better at these languages - I can hack something out, but a lot ...
7
votes
4answers
927 views

Can I demand code quality on a project I've gotten

I have been given a Drupal project from an external web agency and have been trying to becomer wiser on both Drupal and their approach of making a site. With time I've learnt a bit morer about Drupal, ...
7
votes
6answers
3k views

Best way to parse a file

I'm trying to find a better solution for making a parser to some of the famous file formats out there such as: EDIFACT and TRADACOMS. If you aren't familiar with these standards then check out this ...
7
votes
3answers
418 views

Is it a basic principle, or highly desirable, to have class methods that return “$this” rather than a value?

I've really just begun to learn OOP. I started about a year ago and have written probably 15,000 lines of it. But I wrote it all with hardly any experience looking at other people's OOP. Most of my ...
7
votes
5answers
1k views

How to gain experience? [closed]

This is a problem that I think many people will find very common and some guidance from the expert users around here will be appreciated. Background Basically I'm a junior web developer in a team of ...
7
votes
3answers
650 views

What are some really simple rules to keep a PHP codebase organized?

I'm new to PHP in a professional context. I want a few macro thumb rules to keep me on the enlightened path. Here are a few I'm proposing to myself: no absolute paths in include|require(_once)? ...
7
votes
3answers
1k views

Help understanding server-side scripting

As far as I understand, there are basically 3 options for doing server-side scripting these days: Using scripting languages that can be directly interpreted/executed by the web server (e.g., PHP and ...
7
votes
4answers
471 views

Would you refactor this and if so, would you charge your client?

I am working on a freelance job at home. The client wants me to write some new functionality for his CMS, but it is taking me a lot of time to figure out what the code is doing, because it is written ...
7
votes
4answers
2k views

Why don't public web applications use ini files for configuration

Almost every public CMS out there uses a .php configuration file for the database settings and so on. For example WordPress automatically creates a .php config file when you install it. Why don't ...
7
votes
1answer
2k views

Do programmers keep error reporting on or off?

I was wondering if php programmers keep error_reporting in php.ini on or off after delivering the website?
7
votes
4answers
2k views

How important are PHP notices really?

I recently turned all possible error-messages on with error_reporting(-1);, on my PHP project. Of course, right away I got alot of messages. For example: Notice: Undefined variable: foo in ...
7
votes
4answers
2k views

Is MVC just the SEO of PHP programming?

There's around a zillion "PHP frameworks". And most of them bill themselves as following the MVC pattern. While it's welcome to overcome osCommerce coding style (processing logic heavily intermixed ...
7
votes
3answers
307 views

Should public code libraries I have written stay free and open after using them in a contract / commercial product?

I have written a small library of classes in my preferred language (PHP, but it doesn't really matter), and typically use them in most of my projects. Until now, the projects have been personal, or ...
7
votes
2answers
5k views

What is the best way to handle different TimeZones?

I'm working on a web application where there will be many different users from all over the world making updates. I'm wondering what the best way to handle timezones would be? Ideally, as an event ...
7
votes
4answers
664 views

Do $_POST, $_GET, etc violate the encapsulation principle?

Using globals makes your code hard to test thus more prone to bugs, not secure and unpredictable. That's why we pass the variables we want inside a function/object. So my question is simple: Do ...
7
votes
2answers
161 views

Cross-language Test-Driven Development

The short question: How do you follow Test-Driven Development on a project that spans multiple languages? Specifically, I'm writing a web application that uses JavaScript and PHP, and I want to ...
7
votes
1answer
5k views

Pros and cons of namespaces vs include/require in PHP?

I recently started using namespaces in PHP. When I first saw them, I thought that their syntax was ugly and I'd never use them. However, I created an autoloader (spl_autoload_register) that makes it ...
7
votes
4answers
491 views

OOP design question

I'm working on an application written in PHP using OOP principles. The classes in my application usually represent a table in the database; for instance, 'student', 'teacher', 'class', 'schedule', ...
7
votes
4answers
813 views

Is there a performance benefit to using immutable objects in a scripting language?

As I understand it, writing your objects in an immutable style can help the performance of your program for compiled languages, as the compiler tends to rewrite your code in single static assignment ...
7
votes
4answers
190 views

Controllers and re-factoring for maintainability / sensibility

I have read many posts similar to this on the site: however I still am questioning what is best in my situation (also the answers are contradicting from question to question). I have a website ...
7
votes
1answer
3k views

Atomic Memcache Operations in PHP

This post is a follow up to this question: PHP Atomic Memcache on StackOverflow. Considering I am using Memcache (no d at the end) on PHP 5.3.10, I implemented a custom locking system where a client ...
7
votes
6answers
965 views

Assuming “clean code/architecture” is there a difference in “effort” between PHP or Java/J2EE web application development? [closed]

A client asked us to estimate effort when selecting PHP as the implementation language for his next web-based application. We spent about a week exploring PHP, prototyping, testing etc., We are quite ...
7
votes
3answers
2k views

Dependency injection: At what point am I allowed to create a new object?

I am refactoring a PHP application, and I am trying to do has much dependency injection (DI) as possible. I feel like I've got a good grasp of how it works, and I can certainly see my classes ...
7
votes
3answers
724 views

Integrating with a payment provider; Proper and robust OOP approach

History We are currently using a so called redirect model for our online payments (where you send the payer to a payment gateway, where he inputs his payment details - the gateway will then return ...
7
votes
3answers
2k views

OOP oriented PHP app source code samples and advice

The day I have been dreading has arrived. I never felt OOP or good software design was important(I knew they were important, but I thought I could manage without them.). However having read otherwise ...
7
votes
2answers
788 views

Recommended methodology for working with shared libraries and Mercurial

I work in a small team of developers who all collaborate on several Zend PHP projects. We are using Mercurial with a collection of upstream repositories, as well as Jenkins for centralized testing ...
7
votes
2answers
9k views

What does RESTful web applications mean? [duplicate]

Possible Duplicate: What is REST (in simple English) What does RESTful web applications mean? A web service is a function that can be accessed by other programs over the web (Http). To ...
7
votes
1answer
6k views

How to Properly Make use of Codeigniter's HMVC

I have been having problems wrapping my brain around how to properly utilize the modular extension for Codeigniter. From what I understand, modules should be entirely independent of one another so I ...
7
votes
3answers
2k views

Omit terminating semicolon in a tag - a good idea?

It's possible to omit the terminating semicolon in a tag. Example: <table> <th><td>Name</td><td>Email</td> <? foreach ($receivers as $receiver): ?> ...
7
votes
1answer
223 views

Securely sending data from shared hosted PHP script to local MSSQL

I'm trying to add data from a webhook (from a web cart) to a local Microsoft SQL Server. It seems like the best route for me is to use a PHP script to listen for new data (POST as json), parse it, ...
7
votes
1answer
409 views

Need help - brainstorming php scheduler class

I've never written a php class before from scratch. But I guess you have to start somewhere right? I've got an idea, but need help with logic. Please tell me what you think. Below is shorthand ...
6
votes
5answers
703 views

Ruby isn't a PHP generator, right? [closed]

My boss was looking down on me about learning Ruby because "It's just a PHP generator" which I can't find anything about it being so. Is this the case? I understand that the Rails framework can be ...
6
votes
4answers
1k views

Can a loosely typed language be considered true object oriented?

Can a loosely typed programming language like PHP be really considered object oriented? I mean, the methods don't have returning types and method parameters has no declared type either. Doesn't ...
6
votes
7answers
659 views

What is the “PHP Way”?

I see constant references to the " Way," such as descriptions of a particular framework or application as "Pythonic," a certain person as a "Perl hacker," or "true Ruby code," but where are the "PHP ...
6
votes
3answers
5k views

In PHP, how do you code with scalability in mind?

I know this may be a general question, but what exactly goes into scaling for all the users you will encounter, even if not in the next few months? I did some research and most of what is done is ...
6
votes
3answers
952 views

How to explain your non-programmer boss you need to refactor a whole site? [duplicate]

First of all, is not a programming matter, is a programmer afair. I'm the new web programmer in my company. I'm here just for 2 weeks. And they want me to teach Wordpress, configure & install it, ...
6
votes
6answers
1k views

What is an effective way to familiarize yourself with a new application in a new language (and still look productive at a new job)?

I started a new job working on an application I'm vaguely familar with, and it's in Perl! I come from a PHP and Java background, so while I understand the basics, there are lot of nuances in Perl that ...
6
votes
5answers
689 views

Are SQL Injection vulnerabilities in a PHP application acceptable if mod_security is enabled?

I've been asked to audit a PHP application. No framework, no router, no model. Pure PHP. Few shared functions. HTML, CSS, and JS all mixed together. I've discovered numerous places where SQL injection ...
6
votes
4answers
438 views

How does PHP5 fare with earlier versions of the language

I would like to learn PHP for web development but have been drawn back because of comments like the following*: PHP is good but generates spaghetti code PHP is nice but Python is marriage material ...