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

learn more… | top users | synonyms

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
7answers
1k views

How can I make my PHP development environment more efficient?

I want to start a home-brew pet project in PHP. I've spent some time in my life developing in PHP and I've always felt it was hard to organize the development environment efficiently. In my ...
7
votes
4answers
428 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
3answers
908 views

PHP and Ruby: how to leverage both? and, is it worth it?

As you might have noticed from the title, this is not a "PHP or Ruby", or a "PHP vs. Ruby" question. This is a question on how to leverage PHP + Ruby in the same business. I myself am a PHP ...
7
votes
3answers
4k views

Going from PHP to Java

Having been programming in PHP for a year, I now want to start learning Java. I am in a Windows environment. I want to develop a GUI with Java that would query a MySQL database. I know I would use ...
7
votes
4answers
338 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
4answers
172 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
3answers
227 views

Instantiate proper class based on some input

I'm attempting to understand how "switch as a code smell" applies when the proper code path is determined by some observable piece of data. My Webapp object sets an internal "host" object based on ...
7
votes
5answers
603 views

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

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
449 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
532 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
1answer
633 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 ...
7
votes
3answers
1k 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 ...
7
votes
2answers
4k 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
129 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
367 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 ...
7
votes
6answers
5k views

PHP framework most similar to ASP.NET MVC3?

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" ...
6
votes
6answers
4k views

Are frameworks necessary In PHP? [closed]

Are frameworks really necessary in PHP? What are the advantages and disadvantages of using one?
6
votes
5answers
691 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
7answers
624 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
9answers
2k 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 ...
6
votes
6answers
2k 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?
6
votes
9answers
4k 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 ...
6
votes
6answers
784 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
605 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
427 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 ...
6
votes
2answers
530 views

Is it bad practice to output from within a function?

For example, should I be doing something like: <?php function output_message($message,$type='success') { ?> <p class="<?php echo $type; ?>"><?php echo $message; ...
6
votes
3answers
859 views

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

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
5answers
781 views

How could this diagram for “making a career move into software development” be improved?

I'm giving a talk in April 2011 on "Developer English" and showing my non-developer audience, mostly English teachers, various diagrams to explain how developers see their industry etc. One of these ...
6
votes
5answers
15k views

Interview Questions in OOP [closed]

I faced the below interview questions in OOP under PHP language. Kindly clear my clarifications regarding this. I am very confused. As i am a beginner to OOP i got too confused. Could anyone clarify ...
6
votes
6answers
2k 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 ...
6
votes
5answers
331 views

WHat are the benefits of placing the concatenation character at the end or beginning of a line

Considering multiple lines of say SQL query strings: $sql = "select * from table ". "where a=5"; What do you think are the benefits and downsides of putting the concatenation character at the end ...
6
votes
3answers
407 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)? ...
6
votes
6answers
3k views

What is the most basic and simple platform for collaborative development (PHP project)? [closed]

I need to work with 4-5 programmers on a fairly average PHP application using codeigniter. We're in 5 different locations in one city, and all of the programmers are all not too well educated and I'm ...
6
votes
4answers
1k views

Why use phpunit when traditional manual testing can be used

When I make a web app I test my work on the browser to see if I receive any errors and fix them. I have made complex applications and testing this way has been easy and fast. I have watched many ...
6
votes
7answers
715 views

What should someone learn to become a great web-app builder by 2015 [closed]

My brother just started learning some html/css at school and he loves it. He asked me to give my advice on what languages to learn in order to build great web-apps by the time he leaves school. (2015 ...
6
votes
3answers
418 views

Need for a framework [duplicate]

This is slightly different to most questions (trying to avoid duplicates) When would you consider not using a framework (i'm talking PHP here for websites) when does one choose pure html/css/jquery ...
6
votes
3answers
316 views

Why does Zend discourage “floating functions”?

Zend's Coding Standard Naming Convention says Functions in the global scope (a.k.a "floating functions") are permitted but discouraged in most cases. Consider wrapping these functions in a static ...
6
votes
1answer
860 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?
6
votes
5answers
3k views

What advantages does Linux give me when developing in PHP for the web?

I'm about to begin a big PHP project with a friend. It's my first time using PHP and I've been wondering wether I should try developing on Linux since it's so popular. I've had some past experience ...
6
votes
1answer
330 views

General approach to re-factoring an large, very badly written legacy system [duplicate]

Possible Duplicate: Techniques to re-factor garbage and maintain sanity? What is a good way to refactor a large, terribly written code base by myself? Really open question here. I'm not ...
6
votes
3answers
1k views

What are the most common programming mistakes PHP programmers make in Java?

I am more practiced in PHP than in Java, and when I use Java I find myself looking at it from a PHP perspective. This can cause trouble, so I'd like to know, what are the most common programming ...
6
votes
8answers
391 views

How to (professionally) back up reasons for choosing open source technologies in a large project

I know the title is a bit vague so I'll try to be more precise in explaining what's my actual question (I apologize in advance if this is a duplicate). I work for a small company (8 people) that ...
6
votes
1answer
7k views

PHP Framework for RESTful Web Service

I have been going round in circles with this question for days - which is the best PHP framework to use to create a RESTful Web service? I've trawled the web for info and have come across three main ...
6
votes
3answers
295 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 ...
6
votes
3answers
4k views

What is the best PHP ORM library? [closed]

I want to build a PHP web application, but always faces the problem that I need to connect to database and deal with related objects. So I tried codeigniter and it uses a special way to connect to ...
6
votes
3answers
741 views

Migrating from one PHP framework to another

I'm working with a web company that's approaching a point where it will likely need re-think the product as a V2 - due to outgrowing some of its V1 foundations and principles that have been built into ...
6
votes
4answers
5k views

What's the dominant naming convention for variables in PHP: camelcase or underscores? [closed]

The consensus seems to be that one should follow the convention of the platform they're developing for. See: Underscore or camelcase? Naming conventions: camelCase versus underscore_case? However, ...
6
votes
4answers
370 views

Applying DRY to an inheritance hierarchy

I'm working on refactoring a legacy application where I implemented the State pattern successfully as shown in the following diagram: As you see there is a common behavior between the 3 states, so ...