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

learn more… | top users | synonyms

-2
votes
0answers
10 views

Process two forms in 1 PHP file [migrated]

So, I got this piece of code, I'm trying to test it out, my issue is this, I've got 1 single PHP file, which contains 2 variables... what I want to achieve is this, first get the first name from the ...
1
vote
1answer
86 views

Is there a way to document required properties in traits (PHP)?

I'm fairly new to using traits in PHP and am wondering if there is a way to ensure that a class including a trait has particular properties. I know that you can use something like the following to ...
0
votes
1answer
420 views

How should dependencies be managed across a modular application?

Let's say that we have a structure like this: Application -- Modules --Module1 -- Controller -- PublicHelper --Module2 -- Controller ...
-3
votes
0answers
20 views

receiving geojson from client, displaying on google map, responding with url to displayed map [on hold]

am new to all server side stuff, I've set up an ubuntu server with LAMP and have a simple html page displaying a google map and one of their template geojson files overlayed. <!DOCTYPE html> ...
-4
votes
0answers
27 views

Should I build custom CMS from scratch or use an existing framework? [on hold]

so recently an idea came to my mind and I started pursuing it. I would like to develop my own CMS in php to (maybe) learn new things and have a CMS which completely suits my needs. And should I ...
-4
votes
0answers
41 views

What everything should I know by heart in PHP? [on hold]

I tried to google this question with my best ability and couldn't find any answer. I'm a new(ish) PHP programmer and learning PHP kind of stresses me out, because I don't know what I should be ...
0
votes
1answer
60 views

Cleanly using PHP Iterator class in Loops - calling first element

I have implemented the Iterator class in PHP and built the follow mandatory methods as follows class I implements Iterator { private $a = []; function __construct(array $a) { ...
0
votes
1answer
45 views

Send request from a computer, wait for response from another, then trigger an action on both, with PHP [on hold]

I have a website project that is planned to work as the following: User #1, who is registered on the site, sends an invitation for some activity (whichever activity, like playing a game, etc.) to ...
-2
votes
0answers
16 views

How to retrieve a single user data that is owned by the user who log in using session in CodeIgniter? [on hold]

I'm new to CodeIgniter. My problem with my code is that, when a user logged in to his/her account, he can't view his/her details, instead, the detail of the first row from the table where I fetched ...
0
votes
2answers
80 views

Selecting between multiple actions in PHP

I have been programming for a number of years now and in PHP for about 4 of those years. I have always wondered what is the best approach when it comes your program deciding what action to take based ...
0
votes
1answer
74 views

Setting and getting values from a x-y graph

I have a bunch of x-y graphs given to me and I need to be able to transform them into some kind of data structure from which I will be able to get Y with X value. The problem is, though that I have 4, ...
0
votes
0answers
160 views

Writing a PHP wrapper for JavaScript to safely access REST API [on hold]

I am looking for signposting help to secure my API keys when accessing a database over REST API from JavaScript on a webpage. I have read that in order to secure the API key I need to create a wrapper ...
-4
votes
0answers
32 views

Need help in choosing PHP frameworks for my web application (which is similar to freelancer website) [on hold]

I am planning to build a web application similar to functionality as freelancer. I am basically a asp.net developer. But I have chosen PHP as the language of choice to code my web application. I have ...
2
votes
1answer
222 views

Change routing to comply with Law of Demeter

I have a Task, Owner and Plan. Charge values are kept in a plan, owner is on a particular plan and task knows its owner. A task needs to setup its charges based on the knowledge the owner has. Owner ...
-3
votes
0answers
37 views

array loop never stop [on hold]

<?php $ulang = true; for ($i=1; $i <=3 ; $i++) { for ($j=1; $j ...
2
votes
1answer
169 views

Hidden dependencies - why not?

Hidden dependencies: function __construct($dep_registry){ $this->db = $dep_registry->get('db'); $this->request = $dep_registry->get('request'); ... } Not so hidden: function ...
0
votes
1answer
107 views

Laravel relationships and database schema

I am playing around with Laravel and came across something in the documentation for defining 1 to 1 relationships between tables that I would like to get feedback on. The example in the docs is ...
1
vote
1answer
106 views

Using exceptions as regular objects [duplicate]

I have views that handle different errors in my application. For example error 404, 403 and such, giving my errors a more user-friendly presentation. By assumption, they get passed in an exception, so ...
-4
votes
0answers
31 views

Inserting file_path into database using Codeigniter [closed]

I am new to Codeigniter, so having some confusing on this proccess: I have a form field where user can upload any jpg|png|gif file ,the uploaded file is successfully sent to a uploads directory and a ...
0
votes
1answer
47 views

Test logic with external data [duplicate]

I have a site programmed in PHP where I make more call to external server that return me big xml of data. For each record of the xml I have to make other external call to get other data. So my ...
2
votes
0answers
243 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 ...
-4
votes
0answers
137 views

PHP vs Python. Which is best for me and my situation? [closed]

As a beginner programmer, should I learn PHP or Python? I know this has been beaten to death but I would like opinions based on my specific situation. Programming Background - I am a complete newbie ...
1
vote
1answer
210 views

MVC URL structure with URI parameters

When creating routes for your MVC web application I have seen two possible ways to pass variables to a controller method: With the first approach the variable is passed to a parameter of the ...
0
votes
1answer
81 views

Multiple method calls in the constructor and dependency injection

I was asked to refactor some almost ureadable spaghetti code into object-oriented architecture. I have some doubts regarding a class that I designed. Here is the class' skeleton: require_once ...
-4
votes
0answers
24 views

visual basic: get php Query from text box [closed]

How can I get url Query from text box and put it line by line in richtextbox. exemple: I want to get query from textbox1.text : and put it in richtextbox or multilines textbox line by line : ...
2
votes
1answer
62 views

Recommend an approach to decouple Product and Access code constructs, in order to simplify Product testing

I have some code that tightly couples Product specific code and Product-Access code. I am not sure how to untangle it. So for example, for testing Product, I have to mock up Access objects. And ...
0
votes
1answer
1k views

Slower Ajax Response

Does putting the view logic inside the controller increase page load speed? Because I have a controller action calling a view which I am loading through ajax and I am getting a very slow response. Why ...
0
votes
0answers
24 views

Will turning error reporting and error display on and off throughout the stack cause a problem with PHP

I want to turn error reporting and error display on and off for different parts of the same framework (same stack and scope). ini_set('display_errors', 'On'); Changing to 'Off'. ...
4
votes
3answers
164 views

Better way of manipulating large objects

I am doing a lot of work with SOAP Api in PHP and the objects that are returned are quite big. I am then updating the objects from local db changes and pushing them back. So more often than not I ...
1
vote
1answer
76 views

PHP OOP: value property is guaranteed different?

Imagine this code: class Test { public $result; public function makeSum($a,$b) { $sum = $a+$b; $this->result = $sum; } } In a webserver. At same exact moment, ...
2
votes
1answer
951 views

Should I go with PHP.NET and Resharper or PHPStorm [closed]

I am a fairly adept .NET and PHP programmer. These days my pattern of choice for complex web apps is an SOA approach where I use PHP as the front end, and WCF web services as the middle tier. My ajax ...
0
votes
1answer
90 views

Does the phrase “range for R1-1 through R10H” actually have an agreed-upon meaning?

I was recently sent a code test by a potential employer to complete on my own time. The first question has to do with identifying whether a given zoning code falls within a range of codes. I'm not ...
-1
votes
2answers
222 views

New PHP Project - Should I still be supporting PHP 5.2? [closed]

I'm about to start working on a new commercial PHP project with a friend that will be licensed and sold as a script to run on your own shared hosting account or server. Looking at the statistics ...
23
votes
9answers
9k 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 ...
1
vote
5answers
337 views

Are there too many parameters in this constructor? [duplicate]

Check this out: public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\View\DesignInterface $design, \Magento\Framework\Registry $registry, ...
2
votes
1answer
175 views

Laravel 5 Multi-App

So my work has a dashboard built in codeigniter where every app on the dashboard has its own subfolder in controllers / models / views and nothing is shared. I have been tasked with upgrading this to ...
2
votes
2answers
125 views

How to store data in memory(RAM) using php without using Memcache/Redis or any other software? [closed]

I want to implement a cache system in PHP consisting of following features 1) It should be able to store any(large or small) amount of data as long as the memory serves.(key value pair i.e. get & ...
0
votes
1answer
1k views

Reporting Solution in PHP / CodeIgniter - Server side logic vs client side

I'm building a report for an end user. They would like to see a list of all widgets... but then also like to see widgets with missing attributes, like missing names, or missing size. So i was ...
1
vote
0answers
47 views

How to off load DB & API calls (PHP Heroku App) [closed]

I took over support for a PHP app that runs on Heroku. After analyzing the performance with New Relic, I'm noticing that the three bottles necks are the database and API calls to outside services. ...
1
vote
1answer
217 views

Is this a race condition?

I have a friend arguing this is a race condition, but I'm struggling to understand how. This is for a web application using PHP and MySQL where users can login and create tickets, these tickets have ...
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 ...
1
vote
1answer
124 views

Design pattern where decorated object may ask for things like “status updates” from the decorator to perform it's role?

Here's an situation that has haunted one of my open-source projects for quite some time. Imagine if you could represent every front-end input form with a single backend object? An object that ...
0
votes
1answer
146 views

Should I use session or cache to keep the time it last polled when polling to server at intervals?

I'm building a web chat app using session to keep the time the app last polled so that the server can determine whether messages exist between the current polling time and last polling time. It works ...
1
vote
2answers
100 views

Can i write html on one line only in my php code?

i need to embed a html 301 redirect in my php code and i wanted to save chars in my html. Can i write HTML on one line since it is parsed? Is there anything against this practice? ?> <!DOCTYPE ...
0
votes
1answer
67 views

Are there any strong reasons to use DI for sub-classes that are known to be tightly coupled to their parent containers?

I have Product classes for Products A through Z. And each Product class has its own set of product-specific subclasses, which I'd say are tightly coupled to them, like so: //specific product class ...
0
votes
3answers
337 views

How do I handle 3rd party search result data (via cache)

I have a search function on my site and it is taking data from 6 different 3rd party resources. The problem is, it takes too long requesting the data over and over again on the results page. I've ...
1
vote
1answer
154 views

mySQL / PHP design pattern - one function multiple queries

So here's the gist of it. I'm looking for a design pattern where I can have one function, say queryHandler that gets the query and the parameters from a number of different functions and returns the ...
5
votes
2answers
1k views

How is the facade pattern different from abstraction layers?

I just read about the facade pattern and found this example where a client (user of a computer) invokes a startComputer() method which calls on all the complex stuff: Source: wikipedia /* Complex ...
0
votes
1answer
67 views

php Database operations in separate files?

I have a single page application. Select boxes need to be filled with select queries from the database. How do I structure the application? Currently I have a file add_details.php. It contains a ...
0
votes
2answers
102 views

Should I extend an interface or keep it independent?

I'm trying to decide whether to extend a base interface with additional methods or create several independent interfaces. I have a Task interface that looks like this interface Task { public ...