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

Would I benefit changing from PHP to Node.js (in context) [closed]

The situation: We are about to roll out what is essentially a logging service. As we are rather PHP heavy, the current implementation use it. We will have about 200 computers (most on the same ...
7
votes
3answers
403 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
8answers
8k views

What is the best way to INSERT a large dataset into a MySQL database (or any database in general)

As part of a PHP project, I have to insert a row into a MySQL database. I'm obviously used to doing this, but this required inserting into 90 columns in one query. The resulting query looks horrible ...
7
votes
3answers
485 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
6answers
4k 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 ...
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
456 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
1k 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
4answers
1k views

what is a good way to show mysql experience?

As always, if this is a duplicate question that I have yet to uncover, please feel free to close or delete it. I'm attempting to get into the programming industry. I've focused mainly on PHP due to ...
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
300 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
3answers
5k 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
7answers
2k 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
3answers
818 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 ...
7
votes
4answers
458 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
934 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
4answers
462 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
646 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
6answers
4k views

What naming conventions do you use for php classes?

I really like using ClassNames and memberNames as convention but I am not sure how I would name the file containing a class. I like making my classes defined in a file with the exact same name as the ...
7
votes
4answers
179 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
6answers
803 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
531 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
1answer
2k 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
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
630 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
775 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
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 ...
7
votes
2answers
6k 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
173 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
377 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
6answers
5k 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
697 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
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
7answers
633 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
1k 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 ...
6
votes
6answers
876 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
632 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
431 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
3answers
4k 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
2answers
548 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
895 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
16k 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
5answers
797 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
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
336 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
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
2answers
6k views

What is a Developer in Test?

I was recently talking with a recruiter who wants to put me at a company for a position of Developer in Test. He essentially made it sound like a position where you get to fiddle with new programming ...
6
votes
7answers
746 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 ...