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

learn more… | top users | synonyms

8
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 ...
8
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 ...
8
votes
9answers
8k 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 ...
8
votes
11answers
1k views

What are some good ways for an intermediate programmer to build skills? [closed]

Preface: I work mostly in Python, and Web Dev languages (HTML, CSS, Javascript and Jquery, PHP) I'm proficient at coding but I want to get better. In larger more advanced projects my programming ...
8
votes
5answers
3k views

Most MVC-strict php framework [closed]

I have been trying to wrap my head around MVC pattern for about 6 months.I've read tons of articles, Q&A, and blog posts about MVC and HMVC patterns, but I just simply don't get it 100%. I tried ...
8
votes
3answers
903 views

Hallmarks of a Professional PHP Programmer [closed]

I'm a 19 year old student who really REALLY enjoys programming, and I'm hoping to glean from your years of experience here. At present, I'm studying PHP every chance I get, and have been for about 3 ...
8
votes
3answers
1k views

Are there any good use-cases for variable variables?

Today I encountered this little PHP gem called variable variables. $literal = "Hello"; $vv = "literal"; echo $$vv; // => prints "Hello" Are there actually any real use-cases for this language ...
8
votes
6answers
830 views

How can I complete a project as a single web developer? [closed]

I am a PHP 'developer' who codes for fun. My problem is I have never completed my large projects. Please I would like to know how experienced programmers like you are able to complete projects single-...
8
votes
5answers
592 views

Most common website scalability pitfalls

We are designing a website/web application where we hope to to achieve high user counts and, in general, lots of use. More specifically, we intend to be using PHP as the programming/scripting language ...
8
votes
8answers
16k 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 ...
8
votes
4answers
2k 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 ...
8
votes
2answers
3k views

Which open source PHP project has the 'perfect' OOP design I can learn from? [closed]

I am a newbie to OOP, and I learn best by example. You could say this question is similar to Which Scala open source projects should I study to learn best coding practices - but in PHP. I have heard-...
8
votes
4answers
1k views

Design pattern for handling a response

Most of the time when I'm writing some code that handles the response for a certain function call I get the following code structure: example: This is a function that will handle the authentication ...
8
votes
3answers
11k views

How to handle monetary values in PHP and MySql?

I've inherited a huge pile of legacy code written in PHP on top of a MySQL database. The thing I noticed is that the application uses doubles for storage and manipulation of data. Now I came across ...
8
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 ...
8
votes
7answers
13k views

What is the most reliable session storage in PHP: Memcache, database or files? [closed]

What is the best and most safest way to handle PHP sessions. Is the best way to store sessions in: Database (more reliable, but high bottleneck, slow speed, not good for high database usage ...
8
votes
4answers
882 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 $...
8
votes
3answers
1k views

Keeping an MVC model loosely coupled from the DB?

I like to keep my code testable and have decided to go with the Dependency-Injection strategy for my current MVC framework, which definitely has proven to be a great way to ensure loosely coupled code,...
8
votes
4answers
1k views

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

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 developer,...
8
votes
6answers
7k views

What naming conventions do you use for php classes? [closed]

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 ...
8
votes
3answers
492 views

Two components offering the same functionality, required by different dependencies

I'm building an application in PHP, using Zend Framework 1 and Doctrine2 as the ORM layer. All is going well. Now, I happened to notice that both ZF1 and Doctrine2 come with, and rely on, their own ...
8
votes
6answers
598 views

Estimating Cost of modifying someone elses code [closed]

I am relatively new to web development and haven't had to provide estimates for many large projects yet (my last large project was just paid for by the hour without a strict deadline or budget). A ...
8
votes
6answers
747 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
2k views

Is declaring fields on classes actually harmful in PHP?

Consider the following code, in which the setter is deliberately broken due to a mundane programming error that I have made for real a few times in the past: <?php class TestClass { ...
8
votes
3answers
897 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
3answers
3k 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
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): ?> &...
8
votes
1answer
250 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, ...
8
votes
1answer
186 views

Algorithm to generate Edges and Vertexes outwards from origin with max multiplicity of 3

I am creating a 2d game for a website where the universe can grow extremely large (basically infinitely large). Initially, the universe is composed of 6 stars that are an equal distance from the ...
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
979 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
5answers
712 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 ...
7
votes
3answers
1k 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, ...
7
votes
3answers
7k 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 ...
7
votes
4answers
948 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
4answers
445 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 ...
7
votes
5answers
362 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 ...
7
votes
3answers
429 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
4answers
597 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
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
2answers
17k views

Localization in php, best practice or approach?

I am Localizing my php application. I have a dilemma on choosing best method to accomplish the same. Method 1: Currently am storing words to be localized in an array in a php file <?php $values =...
7
votes
3answers
816 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
2k 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
3k 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
3answers
6k 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 ...
7
votes
2answers
6k 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
3answers
2k 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 ...
7
votes
2answers
3k views

What are the different meanings of 'fixture'?

I have some difficulty understanding the concept of "fixture". I know what a test suite is, a test case, a test run, but what exactly is a "fixture"? A parameterized test case? It seems to me that ...
7
votes
2answers
13k views

Java vs PHP Memory / CPU Consumption

I work in a PHP based company. There is a project where we want to create a backend service. Senior members here are going for PHP, even though it is slower than Java. Their only point of contention, ...