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

learn more… | top users | synonyms

106
votes
7answers
7k views

You're hired to fix a small bug for a security-intensive site. Looking at the code, it's filled with security holes. What do you do?

I've been hired by someone to do some small work on a site. It's a site for a large company. It contains very sensitive data, so security is very important. Upon analyzing the code, I've noticed it's ...
56
votes
21answers
17k views

“Don't do programming after a few years of starting career”. Is this a fair advice? [closed]

I am a little experienced developer having approximately 5 years experience in PHP and somewhat less in Java, C# and trying to learn some Python nowadays. Since the start of my career as a programmer ...
53
votes
12answers
2k views

How do you control code quality on your team? [closed]

Here is my situation. After almost 2 years I was able to convince my boss to use TDD, version control, coding standards for the entire team and a MVC framework for our web projects. I was finally ...
40
votes
4answers
36k 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 ...
38
votes
13answers
4k 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(){ ...
37
votes
11answers
2k 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 ...
30
votes
6answers
10k views

Why does Facebook convert PHP code to C++?

I read that Facebook started out in PHP, and then to gain speed, they now compile PHP as C++ code. If that's the case why don't they: Just program in c++? Surely there must be SOME errors/bugs when ...
30
votes
5answers
55k 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 ...
28
votes
15answers
2k views

Is it wise to be going back and forth between two programming languages? [closed]

I have been writing quite a lot of PHP for nearly two years. Now I am doing .NET (mainly c#) development. However, sometimes I go back and do some php. My main question is, is it wise for me to ...
27
votes
10answers
3k views

How do I pitch ASP.NET over PHP to a potential client? [closed]

I work at a Microsoft shop doing mainly web development. We had a client who asked us to review (improve) the data model for his web app, but said that he wants to develop his app in PHP (he knows "a ...
27
votes
12answers
7k views

Why does PHP have interfaces?

I noticed that as of PHP5, interfaces have been added to the language. However, since PHP is so loosely typed, it seems that most of the benefits of using interfaces is lost. Why is this included in ...
27
votes
6answers
10k views

Should I choose Doctrine 2 or Propel 1.5/1.6, and why? [closed]

I'd like to hear from those who have used Doctrine 2 (or later) and Propel 1.5 (or later). Most comparisons between these two object relational mappers are based on old versions -- Doctrine 1 versus ...
25
votes
15answers
2k views

What shall I include in a 10 week web technologies course?

In September I will be teaching a university module on web technologies. This session will be available to 1st year (freshman) students who don't necessarily have any programming knowledge or know ...
24
votes
10answers
3k views

What is good (neat) architecture in programming?

When I build a simple website, e.g. a contact book where I can add, delete and update contacts, I create an index.php file where a user, if he's not logged in, is requested to enter a password and if ...
24
votes
6answers
11k views

How can I apply OOP concepts to building a simple, but real-world, web app?

I've been trying now for a long time to wrap my head around OOP. I see its advantages. I've read many, many tutorials and watched an equal amount of videos on the subject. I get the animal/cat/dog ...
23
votes
6answers
709 views

How to properly take over a complex PHP project [duplicate]

I've been tasked to correct some issues on the backend of a large website project that has been outsourced for some time. The original developers and us are not on good terms so it's not feasible to ...
22
votes
6answers
14k views

Is it bad practice to use <?= tag in PHP

I've come across this PHP tag <?= ?> recently and I am reluctant to use it, but it itches so hard that I wanted to have your take on it. I know it is bad practice to use short tags <? ?> ...
22
votes
8answers
26k views

Which certification is the best for PHP? [closed]

What are the best PHP certifications according to the market requirements? Actually, I want to get the PHP certification which has the greatest demand. Also, I want to know more about the future of ...
22
votes
7answers
13k 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 ...
22
votes
3answers
6k 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 ...
21
votes
9answers
8k 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 ...
20
votes
10answers
2k views

Struggling as a programmer. Need some advice [closed]

I've been a developer now for a number of years. I'm pretty good at what I do and can "get the job done". But, there is a difference between "getting the job done" and "doing the job properly". Let's ...
17
votes
18answers
1k views

How do I “ease into” programming coming from a designer background?

Is there a way I can 'ease in' to programming. Like learning to use/modify CGI scripts to add some functions to a basic html site? Even if it's the only thing I learn it's still useful, right?. Unlike ...
17
votes
6answers
1k views

Best way to plan programming for small teams? [closed]

I am the Director of a small startup organisation. We currently have two programmers (one experienced, one less experienced) who are building a web application platform. One of the greatest ...
16
votes
5answers
5k 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 ...
16
votes
5answers
2k views

Your experience with haxe and other languages that compile to PHP?

I would like to hear opinions from people who have used a language that compiles to php. One such language I know is Haxe. Other ones I've read about are Kira and Pharen. How well do these languages ...
16
votes
3answers
1k views

How to design website workflow?

I have been thinking about this for really long time without reaching an optimum answer. First of all, I'm a medical doctor who loves programming but never really studied it, except for home learning ...
15
votes
5answers
3k views

should I throw exception from constructor?

I know I can throw exception from constructor in PHP but should I do it? For example, if a parameter's value is not as I expected it. Or should I defer throwing an exception till a method is invoked. ...
15
votes
7answers
2k 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, ...
15
votes
7answers
1k views

Why are references rarely used in PHP?

I have some C++ knowledge and know that pointers are commonly used there, but I've started to look at PHP open source code and I never see code using references in methods. Instead, the code always ...
14
votes
10answers
2k views

What attributes of PHP make it insecure? [closed]

It's well known and discussed that PHP has a poor history with relation to security. Is it not a secure language, or are there other reasons for this (such as developer error)? If PHP is truly ...
14
votes
5answers
5k views

Why is PHP so frequently used on web servers?

My web server uses PHP as do 76.9% of web servers according to W3Techs: http://w3techs.com/technologies/overview/programming_language/all The reason I use PHP is an inertia born out of seeing ...
14
votes
7answers
2k views

How to break the “php is a bad language” paradigm? [closed]

PHP is not a bad language (or at least not as bad as some may suggest). I had teachers that didn't even know PHP was object oriented until I told them. I've had clients that immediately distrust us ...
14
votes
9answers
14k views

Type Casting variables in PHP: Is there a practical example?

PHP, as most of us know, has weak typing. For those who don't, PHP.net says: PHP does not require (or support) explicit type definition in variable declaration; a variable's type is determined ...
14
votes
12answers
4k views

How to write a command interpreter/parser?

Problem: Run commands in the form of a string. command example: /user/files/ list all; equivalent to: /user/files/ ls -la; another one: post tw fb "HOW DO YOU STOP THE TICKLE MONSTER?;" ...
14
votes
1answer
543 views

Dollar Sign Blues: Javascript and PHP

I grew up programming C++ and Java where everything was safe and beautiful. Compilers made sure to keep me in check if I ever strayed. Of course, everyone did a little Perl in college, but I didn't ...
14
votes
8answers
2k 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 ...
13
votes
7answers
2k views

What are the benefits of PHP? [closed]

Everybody knows that people that have prejudices against certain programming languages. Especially PHP seems to suffer from problems of its past and some other things (like loose types) and is often ...
13
votes
8answers
3k views

Why do many PHP Devs hate using isset() and/or any of PHP's similarly defensive functions like empty()?

Over on stackoverflow, I see this issue crop up all the time: E_NOTICE ?== E_DEBUG, avoiding isset() and @ with more sophisticated error_handler How to set PHP not to check undefind index for ...
13
votes
7answers
6k views

Confused about ASP.NET Ajax, jQuery and JavaScript [closed]

Yesterday, I read couple of chapters on ASP.NET Ajax and jQuery from my ASP.NET 4 book and I found those frameworks pretty interesting and decide to learn more about them. Today, I borrowed some ...
13
votes
7answers
1k views

stackoverflow induced passivity - how to cope?

After not really working on my pet project for a while, I discovered Stackoverflow and upon perusing it more intensely I was quite amazed. I'm a bit of a perfectionist, so when I found eye-openers ...
13
votes
3answers
5k 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 ...
13
votes
4answers
1k views

Why exactly can't PHP have full unicode support?

Everybody knows, that PHP has problems with Unicode. Version 6 is effectively abandoned, because of Unicode implementation difficulties. But I wonder if anyone knows what are the exact reasons? ...
13
votes
6answers
2k views

Interacting With Data Using Multiple Databases/Servers

All of the projects that I've had to deal with so far have only required a single database on a single server. I'm interested in learning more about how projects that need to scale move to multiple ...
13
votes
5answers
2k views

Why are PHP function signatures so inconsistent?

I was going through some PHP functions and I could not help notice the following: <?php function foo(&$var) { } foo($a); // $a is "created" and assigned to null $b = array(); foo($b['b']); ...
13
votes
9answers
6k 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 ...
13
votes
3answers
833 views

What is the best way to do offline failover of a desktop based client that uses a web service?

I have three incoming projects that share a common problem: they need to have the logic on a web system and they need a local application (e.g. point of sale) that communicates with such system ...
12
votes
5answers
1k views

Why is my class worse than the hierarchy of classes in the book (beginner OOP)?

I am reading PHP Objects, Patterns, and Practice. The author is trying to model a lesson in a college. The goal is to output the lesson type (lecture or seminar), and the charges for the lesson ...
12
votes
5answers
10k views

Why is Python slower than Java but faster than PHP [closed]

I have many times seen various benchmarks that show how a bunch of languages perform on a given task. Always these benchmarks reveal that Python is slower then Java and faster than PHP. And I wonder ...
12
votes
6answers
724 views

Tips for planning a rewrite of a large PHP project?

I've decided to completely rewrite a PHP framework (Using MVC) that I've been working on, on and off, for years. My problem up until now was that I would just come up with ideas, throw them into Trac ...