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

learn more… | top users | synonyms

0
votes
1answer
136 views

Service layer coupling

I am working on writing a service layer for an order system in php. It's the typical scenario, you have an Order that can have multiple Line Items. So lets say a request is received to store a line ...
0
votes
1answer
146 views

What are some efficient ways to set up my environment when working on a remote site?

Hello fellow Programmers, I am still a relatively new programmer and have recently gotten my first on-campus programming position. I am the sole dev responsible for 8 domains as well as 3 small sized ...
4
votes
3answers
750 views

Dependency injection: At what point am I allowed to create a new object?

I am refactoring a PHP application, and I am trying to do has much dependency injection (DI) as possible. I feel like I've got a good grasp of how it works, and I can certainly see my classes ...
3
votes
1answer
150 views

Where should the database and mail parameters be stored in a Symfony2 app?

In the default folder structure for a Symfony2 project the database and mail server credentials are stored in parameters.yml file inside ProjectRoot/app/config/parameters.yml with these default ...
0
votes
3answers
133 views

Is it okay to just add a page or two PHP page to add some functionality to a Drupal site?

I'm not familiar with Drupal, really. I can dig around the admin interface and navigate the directories and find the files that I need to just fine as well. What I'm really not familiar with is ...
1
vote
1answer
170 views

Loose typing not applied to objects

I have very little experience working with classes and object. I work in a loosely typed language, PHP. I was working with a SimpleXML object and ran into a problem where I was trying to do math with ...
2
votes
2answers
198 views

Theory Of A Weird Thought - Forms Submission

In theory, if you were to open two computers that were perfectly synced together on a website that has a form. This form has fields where say for example the username has to be unique. Assuming both ...
0
votes
1answer
646 views

I need to create an employee schedule/appointments program, but I don't know how to set it up [closed]

I work for a gym. I am the programmer, its just me, nobody else! Gets really frustrating when there's nobody to bounce conceptual ideas off of. I'm getting rid of our archaic paper binder systems for ...
0
votes
0answers
117 views

Algorithms or patterns for a linked question and answer cost calculator

I've been asked to build an online calculator in PHP (and the Laravel framework). It will take the answers to a series of questions to estimate the cost of a home extension. For example, a couple of ...
0
votes
0answers
426 views

Syncing client and server CRUD operations using json and php

I'm working on some code to sync the state of models between client (being a javascript application) and server. Often I end up writing redundant code to track the client and server objects so I can ...
0
votes
4answers
386 views

PHP: A config file in .ini or .php format?

I'm working on a huge CMS system, and I asked myself what configuration format I should use. There are two common formats for configuration files. The first one is an INI file, containg all the ...
1
vote
3answers
140 views

Repository query conditions, dependencies and DRY

To keep it simple, let's suppose an application which has Accounts and Users. Each account may have any number of users. There's also 3 consumers of UserRepository: An admin interface which may list ...
0
votes
2answers
78 views

Area of testing

I'm trying to understand which part of my code I should to test. I have some code. Below is example of this code, just to understand the idea. Depends of some parametrs I put one or another currency ...
0
votes
3answers
682 views

ASP.NET Web Forms is bad, or what am I missing? [closed]

Being a PHP guy myself I recently had to write a spider to an asp.net site. I was really surprised by the different approach to ajax and form-handling. For example, in the PHP sites I've worked with, ...
1
vote
1answer
117 views

Store data for multiple User Type

I am developing an app where four types of user share same module. So is it a good idea to create: one table and user_type and user_id (something like that) table prefixes basically 4 diff tables of ...
11
votes
5answers
689 views

What Do I Need To Know About Servers In a Web Development Role? [closed]

I know that may sound a little vague, so I'll try and explain a little further... After being self employed developer for many years I'm now in search of a commercial web developer role. My only ...
3
votes
2answers
2k views

Building a database class in PHP

I wonder if I should write a database class for my application, and if so, how to accomplish it? Over there on SO, a guy mentioned it should be written as an abstract class. However, I can't ...
1
vote
2answers
346 views

Should I close database connections after use in PHP?

I wonder if I should close any unnecessary database connection inside of my PHP scripts. I am aware of the fact that database connections are closed implicitly when the block stops executing and ...
-1
votes
1answer
838 views

Printing a table from mysql and php as PDF [closed]

I would like some help with printing out put of mysql tables as PDF. I have scenarios where a user views their details from the database printed to an HTML table, I would the same HTML table to also ...
1
vote
1answer
103 views

Helper functions - well defined inputs or well defined outputs?

Problem In Codeigniter (PHP framework), I am trying to create a helper function that will inject an ActiveRecord (for MySQL) command into a chain of existing ActiveRecord calls. The reasoning for ...
1
vote
1answer
663 views

How to create unit/integration tests for my web app?

I am currently developing an Ajax chat application that uses PHP on the back-end. Some of the features it has right now are different types of users (admin/mod/banned), public and private rooms, ...
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 ...
0
votes
1answer
3k views

Why would one prefer C# (ASP.NET MVC) or Java (JSP) instead of PHP for web applications/projects [closed]

I'm wondering, why would one (consider it not just a single developer, but a company) prefer C# or Java for web applications? What's their considerations regarding the question. I mean, a company, has ...
0
votes
1answer
341 views

Interview for job that uses skills you have no experience with? [closed]

I am currently employed as a software developer using C# and C++. However, I want to find a new job for personal reasons and applied for a job ad that listed PHP, CSS, and Javascript as the skills the ...
-3
votes
1answer
294 views

What is the Meaning of Return False in a Php Function

i wanted to know what is the meaning of return False in an function. go Through this function: function reset_password($password,$user_id) { $sql="UPDATE user SET password='$password' WHERE ...
2
votes
2answers
459 views

is it bad that I have no html, or javascript in my php files

I have been writing my website, front-end: html, JS, jquery and css, back-end: php mysql. However my php files only contain php and mysql code. Is this a really bad thing? In what situation should PHP ...
4
votes
2answers
1k views

Best Practices PHP mvc routing

I have a custom MVC framework that is in a constant state of evolution. There's a long standing debate with a co-worker how the routing should work. Considering the following directory structure: ...
0
votes
1answer
109 views

Control Flow of php

I have a php script example1.php How would the control flow be when I call another php script example2.php from example1.php. Foe E.g example1.php looks like this .... ... .... example2.php ...
-2
votes
1answer
157 views

PHP developer, how to solve javascript related issues in a program with millions of line [closed]

I am expert in PHP. There are some JavaScript related bugs in my assignment given by my supervisor. I tried to fix them using Firebug. It is time consuming. Is there any other ways? Are there any ...
0
votes
2answers
458 views

Good or bad code? Or “a secret reason”?

I think this code: if(file_exists("amodule.inc.php")) require_once("amodule.inc.php"); is misleading because of the use of the require_once. I think that - to keep the logic and "wording" ...
2
votes
1answer
262 views

PHP high traffic default page

I have a php website that will be experiencing high levels of traffic in a few weeks. We scaled the servers to accept the traffic, but want some sort of fallback page in the event that something ...
1
vote
0answers
115 views

How to bypass Oauth2 authentication when the client and resource owner is the same entity?

We are currently working on using an API provided by Mercado Libre which is a maket place for selling various goods. Their APIs use OAuth 2.0 for authentication. The problem is that OAuth 2.0 as ...
0
votes
1answer
132 views

Making Code Changes While PHP Script Is Running

I have a PHP program running right now that is processing database rows of over 6 million. Considering the speed at which number of records have been processed so far, it looks like the whole process ...
8
votes
5answers
1k views

Multiple arguments in function call vs single array

I have a function that takes in a set of parameters, then applies to them as conditions to an SQL query. However, while I favored a single argument array containing the conditions themselves: ...
2
votes
2answers
425 views

OOP Objects, nested objects, and DAO's

Here's something I keep struggling to figure out the best solution to. I've had this problem while working with PHP and Java so it's a fundamental understanding of OOP issue. Examples are in PHP. ...
2
votes
3answers
626 views

Chain-of-Command/Responsibility pattern for my simple API. A good idea?

I need to write a simple API for a project I'm working on. This API will be used internally to perform some server side actions that were triggered by AJAX calls. To make things easier for me, I ...
1
vote
1answer
158 views

which directory to initialize git repo

I'm just getting started with Git. I'll be doing PHP development and was wondering if I should initialize my repo within my server root folder, or any directory on my hard drive and publish my ...
0
votes
1answer
137 views

Multiple conditions in a function using PSR

I'm trying use the PSR conventions in all my projects, but today I view some code of my co-worker and I disagree. if ($cond == 1 AND $cond == 2) { // to-do } For me, the correct is: if (($cond ...
1
vote
2answers
209 views

Arguments for conforming to PSR-2

I am trying to convince the lead developer of an open-source project I'm contributing to, to conform to the PSR standards (PSR-2 in particular) created by the PHP Framework Interop Group. He is ...
4
votes
1answer
631 views

Objects of different programming languages

Apparently, there are some resemblance between objects in JavaScript and dictionaries in Python. Each language defines an object a little different (and there is some logic that all definitions to be ...
1
vote
1answer
185 views

Unit testing methods which access an Internet API

Hi I'm developing a Wordpress plugin which accesses a couple of API's (Amazon Product API, Flickr, Freebase, Ebay). I've already started writing unit tests for it but I'm still wondering if its ...
1
vote
1answer
163 views

How should I handle two crons that update the database?

I'm working on a Bitcoin-clone block explorer (specifically Mincoin) which has a block timer of about 1 minute. For those unfamiliar with Bitcoin, basically a new data structure called a block is ...
3
votes
2answers
258 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 ...
1
vote
4answers
388 views

Which ASP.Net programming model is closer to PHP? [closed]

I've been using ASP.Net WebForms for the last year or two at work for development, but I've used PHP for personal projects for 10 years. So, I'm far more adept at developing with PHP. When it comes ...
2
votes
3answers
543 views

Is it good practice to return an array of objects?

If I have an ItemContainer class that contains, for example, items in an order, where each item is an Item object; is it best to have a method like: ItemContainer->getItems() that returns an ...
0
votes
2answers
670 views

More efficient way to paginate search results

I'm making a website in PHP where the user can search a big MySQL database. The user is shown the first result. I want the next button to take the user to the next result, and so on. The trivial ...
0
votes
3answers
453 views

What's best practice for a SELECT * FROM SQL in PHP? [closed]

I need to make a "SELECT * FROM" Sql from PHP, that now returns about 10.000 records, that I insert in an Array and re-utilize in a page to show results in a table. I need to have all that elements ...
2
votes
5answers
844 views

Planning relational database - one or two tables?

I'm currently planning the database structure of a used car's advertisements site. Each advert contains information about a vehicle, and a vehicle can be advertised multiple times over its lifespan ...
2
votes
1answer
240 views

How to find classes that use certain DB tables

Problem: I'm asked to prepare a document where all our DB tables are listed and I'm supposed to list all Controllers that uses these DB tables for read and another list for Controllers that do write ...
2
votes
2answers
276 views

Should I put utility methods inside a class?

I have been working on a library which contains a large set of functions. For the sake of simplicity, I am going to use just one set as an example. I am not sure which is the better way, in terms of ...