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

learn more… | top users | synonyms

13
votes
9answers
10k views

When do I need to use a framework? [closed]

I am new to web programming and at this time I am learning about PHP. I would like to know when do I need to use a PHP framework such as CakePHP? What are things that this and other similar PHP ...
10
votes
3answers
2k views

what are the best tips for storing images in a database?

Is it appropriate to store the image files in the database? Or it would be better to store only the path of the file in the database, while keeping the file itself on the server? Are there any other ...
10
votes
4answers
1k views

When should I use mock objects?

I've read a lot of things about TDD but I still have doubts. For example, I have these class diagrams: It's a simple example, just to learn about TDD and mock objects. Which test should I write ...
46
votes
4answers
70k views

How can I test PHP skills in a interview? [closed]

My company needs to hire a PHP developer, but nobody has PHP knowledge in my company and we find difficult to test for PHP skills. If it were a C/Java developer I would ask him to write a quick ...
22
votes
5answers
9k views

What best practices should be employed in a PHP login script?

I am wanting to re-write my login scripts for clients websites to make them more secure. I want to know what best practices I can implement into this. Password protected control panels are in their ...
23
votes
9answers
10k views

Should I build my own CMS or rely on a pre-built one? [closed]

Related: As a beginning programmer, should I favor building my own libraries over using 3rd-party libraries? As an intermediate to advanced level PHP web-developer and a young one at that ...
21
votes
3answers
8k views

I'm trying to understand hash tables - can someone explain it to me - clearly?

I want to understand the correct use and implementation of hash tables in php (sorry). I read somewhere that an in-experienced programmer created a hash table and then iterated through it. Now, I ...
17
votes
8answers
3k views

What would you consider best practice workflow tools for web application (PHP) development? [closed]

I'm really hoping somebody with more experience can edit the question as per my examples of answers: using version control test driven development debugging code (xdebug for php) use of UML diagrams ...
3
votes
2answers
3k views

PHP Interview test. Any advice? [closed]

I am going to be doing a short PHP test/project (20-30 mins) at an interview very soon. The job is at a junior to mid-weight salary (although no specific knowledge level is in the job spec) at a media ...
39
votes
5answers
82k views

When to use PHP or ASP.NET? [closed]

I have worked extensively in developing web applications using PHP and ASP.NET, but one of the questions that I'm constantly asked by customers is whether to move forward with a php website or an ...
31
votes
7answers
22k views

Why is Zend Framework so complicated?

I am web developer and have experience of developing several web applications in PHP. I have an idea of developing a product for myself and decided to use a MVC based framework because I really like ...
43
votes
13answers
9k views

Is it considered bad practice to have PHP in your JavaScript

So many times on this site I see people trying to do things like this : <script type="text/javascript"> $(document).ready(function(){ $('<?php echo $divID ?>').click(funtion(){ ...
14
votes
4answers
21k views

Why did Facebook use C++ beside PHP?

What is the main reason that made Facebook need to use C++ beside PHP? I am wondering if I make a website with alot of vistors would I need to use C++ as well?
26
votes
3answers
11k views

How to build completely modular web applications [closed]

In the coming months we're going to begin a project where we take a system we've built for a client (v1) and rebuild it from scratch. Our goal with v2 is to make it modular, so that this specific ...
8
votes
5answers
3k views

PHP, HTML, Javascript and writing good practices

I realized I have to write down a convention specification about HTML, JavaScript and PHP coding for me and my team. In web development, just like in C++, I'm definitely a fan of indentation and ...
16
votes
7answers
3k views

Is it possible to effectively develop PHP applications on Windows that will be deployed on servers running Linux?

Is it fine to code PHP on Windows and host it later on a server running Linux? Can there be any problems in the migration of such a project? I would think that there really can't be any problems, ...
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 ...
15
votes
4answers
6k views

Why is using 'final' on a class really so bad?

I am refactoring a PHP OOP legacy website. I am so tempted to start using 'final' on classes to "make it explicit that the class is currently not extended by anything". This might save lots of time ...
5
votes
3answers
572 views

How do I determine which language/framework is best for our web-based project?

I'm in the early stages of development for a web application that has three developers (myself included) working on it. The project is, at its core, a web-based database that will be used by around ...
2
votes
1answer
1k views

Is “PHP and MySQL Web Development, 4th ed.” an outdated book to learn from? [closed]

I want to get into web stuff, and thought of going with PHP+MySQL. I have experience in C#, C++, desktop graphics, but no web stuff besides HTML, CSS which I started learning 2 months ago. On SO ...
18
votes
6answers
14k views

Naming classes, methods, functions and variables [duplicate]

There are 3 important naming conventions: with_underscores PascalCased camelCased Other variants are not important because they are not commonly used. For variables it seems that the one with ...
5
votes
5answers
1k views

Which open-source license is right for my project?

I am trying to choose the right license for a project that I would like to release as open-source later this year but I am unsure as to what the most appropriate license would be. I was originally ...
10
votes
2answers
712 views

What is a good way to familiarize myself with PHP, coming from an ASP.NET background? [closed]

Currently, I'm very comfortable with building tools/web apps in an ASP.NET environment. I'm not really looking to leave tbh, as I really like C#, ASP.NET, MVC 3, Visual Studio, etc. However, right ...
37
votes
11answers
3k views

Why isn't protection against SQL injection a high priority?

On Stack Overflow, I see a lot of PHP code in questions and answers that have MySQL queries that are highly vulnerable to SQL injection attacks, despite basic workarounds being widely available for ...
10
votes
2answers
839 views

How can I use my coding skills for good?

By this autumn my two small websites should be generating around a total of $1200 a month with minimal/zero input which is enough to for me to live on comfortably enough. Rather than embark on ...
0
votes
3answers
411 views

Familiarizing with the Zend Framework in one week [closed]

You are conversant with the ZF? How would you go about getting familiar with it in one week? What would be your suggested schedule?
10
votes
4answers
2k views

In MVC, can/should basic data retrieval from the Model be done in the View?

Given the concept of 'skinny controllers, fat models' and the general acceptance that Views can directly call on Models when requiring data for output, should one consider handling the 'get and ...
6
votes
4answers
2k views

When is it necessary to use ORM tools? [closed]

I was raised in a part of web developmentland where the creation of websites is mostly synonymous with Wordpress, FTP, Joomla, and procedural code, instead of things like TDD, A/B testing, Doctrine, ...
3
votes
3answers
5k views

The best possible way to implement Business Rules in PHP

I'm planning to write an e-commerce app using PHP & MySQL with lots & lots of custom rules. Say for example, I want to have a rule like "Give Customer X, a 10% a discount for Product Y if he ...
14
votes
2answers
2k views

Illegal in PHP: Is there an OOP design reason?

The below interface inheritance is illegal in PHP, but I think it would be fairly useful in real life. Is there an actual antipattern or documented problem with the below design, that PHP is ...
10
votes
3answers
3k views

Is the term 'Front-End' synonymous with 'Client-Side'? If so, is this always the case?

As a relatively new (self-taught) web developer, I've heard the terms front-end, client-side, back-end, and server-side quite often. To me, front-end and back-end were always synonymous with ...
8
votes
1answer
2k views

What is Zend's relationship with PHP?

What exactly is Zend's relationship to PHP? I don't mean the framework but the company itself. Are they the gatekeepers or guardians of sort? I've just been reading up on PHP, and other than ...
16
votes
4answers
19k 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, ...
9
votes
3answers
11k views

What is a Developer in Test? [closed]

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 ...
9
votes
7answers
3k views

Joomla or development from scratch? [closed]

As someone who has very little experience in it, I would like to know what makes you think that Joomla can fulfill all you requirements?. What makes you choose it over development from scratch (or ...
6
votes
3answers
6k views

Going from PHP to Java [closed]

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 ...
3
votes
2answers
3k views

What is the best way to create REST API error response model and error codes system?

My REST implementation will return errors in JSON with next structure: { "http_response":400, "dev_message":"There is a problem", "message_for_user":"Bad request", ...
3
votes
6answers
857 views

When to use a API/Library and when to write your own?

I am working on a large website and having been thinking a lot about when I should be using a 3rd party API/Library and when I should be writing my own implementation from scratch. There is no Library ...
3
votes
2answers
901 views

Why do ruby and python seem to have more community contribution than PHP? [closed]

In a recent blog post by Roy Osherove, it is pointed out that his switch from primarily .Net development to ruby development has seen a huge difference in community involvement and really enjoys it. ...
2
votes
3answers
2k views

OO PHP static keyword, should I use it?

I'm writing script for fb and I have 3 objects that I'll be using through all classes. I'm wondering if there is any advantage in using the static keyword except I don't have to create an instance ...
2
votes
9answers
10k views

Is there a way to develop desktop software using PHP?

I have to develop a real estate marketing CRM software for my client - where the application is installed on desktop but can also be accessed from web. 2 reasons why they want the application to run ...
11
votes
4answers
745 views

Is it OK to introduce methods that are used only during unit tests?

Recently I was TDDing a factory method. The method was to create either a plain object, or an object wrapped in a decorator. The decorated object could be of one of several types all extending ...
8
votes
9answers
2k views

My university doesn't provide php courses because it is an “easy” programming language? [closed]

I've met a student from the computer science department and I discovered that they only teach java and aspx. I asked him why they didn't teach php since it is the top one programming language on the ...
6
votes
3answers
457 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 ...
4
votes
4answers
2k views

Best Method of function parameter validation

I've been dabbling with the idea of creating my own CMS for the experience and because it would be fun to run my website off my own code base. One of the decisions I keep coming back to is how best ...
4
votes
3answers
1k views

When do I need web services?

Are there any general guidelines to understand when I should consider using (as a eat-your-own-dogfood) and providing web services, and when I shouldn't worry about them? Or, any reading materials you ...
4
votes
3answers
2k views

For a large website developed in PHP, is it necessary to have a framework? [closed]

I am wondering if it is necessary to have a framework or if it is a must-have if I plan to make a large website. Large website could mean a lot of things: in other words, multiple dynamic web pages ...
3
votes
4answers
3k views

PHP, structural or OOP based language? [closed]

I would like to discuss why is PHP called a structural language? what are the OO concepts that cannot be implemented using PHP?
10
votes
5answers
1k views

Advantages to Multiple Methods over Switch

I received a code review from a senior developer today asking "By the way, what is your objection to dispatching functions by way of a switch statement?" I have read in many places about how pumping ...
3
votes
2answers
2k 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 ...