Questions tagged [php]

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

Filter by
Sorted by
Tagged with
11
votes
7answers
2k views

Is there anyone who has used Python/Ruby and PHP for a long time and still prefer PHP? [closed]

I am usually fascinated by articles defending PHP and the arguments being used. Quite often authors of these types of articles don't mention what experience they have with other languages. Personally ...
10
votes
2answers
836 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 ...
8
votes
3answers
2k 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 ...
14
votes
6answers
13k 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 ...
8
votes
5answers
4k 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 ...
7
votes
5answers
7k views

Reverse Engineering PHP application without reading the (ugly) Code

I have this new customer, that has this PHP App. It was written by a single developer that wanted to "make yet another framework" back in 2005. About 3 Years later the developer left the company, and ...
7
votes
5answers
2k 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 ...
6
votes
3answers
1k views

Are there standard style guides for PHP? [closed]

I've been working in a very small team for PHP development and we've been using an ad-hoc, "Invented Here" style guide. Now that our team and codebase is growing, we would like to use a more broadly-...
1
vote
2answers
16k views

Simple real-world PHP OOP example?

I'm trying to learn PHP OOP, but when I've followed tutorials, all the examples seem to involve things like: class Human { $_sex; public function setSex($sex) { $this->_sex = $sex;...
19
votes
3answers
6k views

Is it good practice to avoid warnings and notices?

I've generally been working with PHP warnings and notices off, since I work on a lot of projects where it's already in live production. Now, if I turn on the warnings and notices on these live ...
11
votes
3answers
4k views

Composition over inheritance but

I'm trying to teach myself software engineering and coming up against some conflicting information which is confusing me. I've been learning OOP and what abstract classes / Interfaces are and how to ...
9
votes
2answers
19k 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 clarify a ...
17
votes
2answers
10k 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 ...
13
votes
2answers
2k views

How to go about testing un-injectable code?

So I have the following piece of code in use all over my system. We're currently writing unit tests retrospectively (better late than never was my argument), but I don't see how this would be testable?...
10
votes
6answers
2k views

What kind of Web development projects benefit from using ORM?

I'll start by saying that I've done 95% of my database work using SQL. Recently, I did some investigation of various ORMs, such as NHibernate and Doctrine. I can see the advantages of not needing to ...
6
votes
2answers
2k views

How to use SOLID principles in this example

I have reading about SOLID principles last week and decided to try to solve real world problem by using them. So I got the problem of real world ecommerce site managing totals. Problem Statement: ...
11
votes
4answers
2k views

What is happening to PHP 6? [closed]

I am excited about the changes in PHP 6 previewed in PHP 5.3+. However, I wonder why it takes so long to release PHP 6? Books about it have been published since 2008, and announcements on it since ...
11
votes
2answers
26k 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
5answers
1k views

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

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

Purely technical reasons for PHP as a first choice?

I know this may come off as a flame-y / troll-y, but I hope you will take my word for it that it's not my intention. I am just trying to understand the PHP phenomenon. After looking at the many ...
6
votes
5answers
992 views

Are mocks in unit tests dangerous in dynamic languages?

I've started relying heavily on a mocking framework in php for my unit tests. My concern is that with a dynamic language, there is no way of enforcing a return type. When mocking, you have to ensure ...
4
votes
1answer
3k views

PHP Parallel Requests and Session Stability

I've experienced a lot of issues that were the result of the nature of PHP living within the bounds of a stateless HTTP request, especially considering the asynchronous environment expected of modern ...
4
votes
1answer
341 views

Is '@' Error Suppression a Valid Technique for Testing for an Optional Array Key?

Rarst and I were debating offline about the use of the '@' error suppression operator in PHP, specifically for use to test for existence of "optional" array keys, i.e. array keys that are being used ...
3
votes
3answers
7k views

Open Source PHP Encoder [closed]

Are there some recomendations on Open Source or Free PHP Encoder systems? Is something available?
3
votes
3answers
559 views

How can I cope with every increasing/changing number of frameworks? [duplicate]

I started coding with php, mysql, html, and javascript back in 2002 and heck that is all you basically needed to create any type of website. Over the years I picked up other languages, but what turned ...
3
votes
3answers
580 views

Tell don't ask vs constructor doing work

When you browse for the phrase "constructors must not do work", then in various blog posts you will find the advice to not let the constructor do work. Despite this, I am having some trouble ...
2
votes
3answers
384 views

Is it acceptable to work around Apache's .htaccess nonsense in another language?

I'm getting sick of all of Apache's quirks, and I'm considering starting to avoid .htaccess as much as I can in favor of writing actual, predictable code. It would be easy and straightforward to ...
2
votes
1answer
2k views

Liskov principle: violation by type-hinting

According to the Liskov principle, a construction like the one below is invalid, as it strengthens a pre-condition. I know the example is pointless/nonsense, but when I last asked a question like ...
-4
votes
3answers
1k views

Why different languages have different syntax? [duplicate]

Different programming language always/most of the time use different syntax. For example take PHP, Java and Python. In Php & Java semicolons are compulsory at the end of the line, yet Python ...
10
votes
2answers
3k views

Should HTTP Request/Response objects be immutable?

I think it's safe to say that most web applications are based on the request/response paradigm. PHP has never had a formal abstraction of these objects. One group is trying to change this: https://...
7
votes
3answers
2k views

what are the benefits of closure, primarily for PHP?

I am beginning the process of moving code over to PHP 5.3 and one of the most highly touted features of PHP 5.3 is the ability to use closures. My understanding of closures is that they allow ...
6
votes
2answers
577 views

Strategy to use two different measurement systems in software

I have an application that needs to accept and output values in both US Custom Units and Metric system. Right now the conversion and input and output is a mess. You can only enter in US system, but ...
6
votes
4answers
2k views

Can a loosely typed language be considered true object oriented?

Can a loosely typed programming language like PHP be really considered object oriented? I mean, the methods don't have returning types and method parameters has no declared type either. Doesn't ...
5
votes
5answers
4k views

What are the advantages/disadvantages of using objects as parameters to other object methods?

I'm mostly thinking of PHP here, but if you want to refer to other languages that's fine. An object has a method that requires data contained in another class of object. Should I extract that data ...
5
votes
5answers
1k views

Multi MVC processing vs Single MVC process

I've worked fairly extensively with the MVC framework cakephp, however I'm finding that I would rather have my pages driven by the multiple MVC than by just one MVC. My reason is primarily to maintain ...
5
votes
3answers
508 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
1answer
1k views

How can I integrate and store sessions in my database, as opposed to storing them in a cookie and file system?

I've never worked with sessions in a database before, and I'm a little unclear on how they work. I have a user class already designed which stores user information: username, password, email etc. I ...
4
votes
3answers
4k views

Arrays vs Objects in view template

I am wondering, in view templates, what would contribute to me choosing between using arrays or objects for getting things printed out in arrays {{$user->zip_code}} vs {{$user['zip_code']}} I'm ...
4
votes
2answers
1k views

How should I be keeping track of php script version/changes?

How should I be keeping track of a php script's versions/changes when it pertains to a single script in one file? Should I have a separate changelog, and if so (1) what should it be named, (2) how ...
4
votes
3answers
1k views

Application Logic Vs DB Triggers for database cleaning

When cleaning out old data from a set of database tables, is it safer to have the logic in the application or in a database trigger? I am upgrading an application that I wrote a while back (and in a ...
3
votes
2answers
229 views

Results stored in a session - good idea?

To give a bit of background, lets say it's a generic results page, which is paginated so there are X results per page. Generally to do this, I have two queries on the page: to get the total number ...
2
votes
4answers
4k views

How do I speed up XML parsing operation?

I currently have a php script set up to do some xml parsing. Sometimes the script is set as an on page include and other times it is accessed via an ajax call. The problem is the load time for this ...
2
votes
2answers
104 views

How do I decide whether to make an Input/Output data type an array or a class?

I have some input that I send to a computational library, which processes the input and produces some output. Question: What considerations do I take into account to help me decide whether the ...
2
votes
3answers
3k views

Design for creating a menu based on user type

Problem I am building a PHP application which has a main menu, which in turn contains various "sections" or "subheadings" with various links. There are several user types such as SuperAdmin, Admin, ...
2
votes
3answers
737 views

PHP coding practice [closed]

I'm a self taught PHP programmer. Because I have no formal training in PHP, I often find my coding style to be considerably different than example code I find on the Internet. I've slowly started ...
2
votes
1answer
5k views

Should I use a workflow engine?

I need to add some new features to a PHP application. It is to follow the steps of a order. A process create some orders, the order goes to confirmation, then if approved is sent to a provider, later ...
1
vote
2answers
508 views

PHP-based indexing and search implementation

Is there such thing? I designed a while back a rudimentary form based app for my users. We receive from our suppliers hardware manufacturing data in XML files: file name is made of eleven fields ...
1
vote
1answer
496 views

How to handle coding errors in my PHP AJAX code?

How do I handle coding errors in my PHP which has no GUI, only an API? I am concerned that I might never know that there are any. Note that only I will develop the client side. This is not a public ...
1
vote
6answers
597 views

Interfaces: profit of using

First of all, my ubiquitous language is PHP, and I'm thinking about learning Java. So let me split my question on two closely related parts. Here goes the first part. Say I have a domain-model ...
1
vote
3answers
337 views

Controller in MVC

Alright so it is an essential part of OOP that one class should only do one thing, and it makes sense. In practice I've seen that classes which don't obey this rule get thick and cluttered. So I was ...