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

learn more… | top users | synonyms

-4
votes
0answers
9 views

Laravel 5 + homestead MySQL config issues [on hold]

I'm new to Laravel 5 and Homestead and I'm just trying to set up my first project. I've got homestead working with the default config + my project path mapping. I've set up my .env file as follows: ...
-2
votes
1answer
6 views

Function statements executed without being called

I was trying to create something of a PHP template that appended HTML and (processed) PHP files into a DOMDocument object. As I needed to do this multiple times, naturally I created functions to do ...
-4
votes
0answers
12 views

Simplest way to parse a title from an HTML file using PHP functions only, no extra classes [on hold]

So far I've been trying to get a simple way to stract a title from an HTML page. This simple: $url = "http://localhost"; Use any function to extract the title tag using only PHP functions or ...
-3
votes
0answers
22 views

Web Services Android [on hold]

Android Web Service 1.I want to write a program that data is stored on the server and other users can read the data. I have to write server database with php ,so that I save multiple fields or from ...
0
votes
1answer
85 views

Java front-end, PHP/MySQL back end methodology

I have been basically out of the programming world for about 10 years, with only a bit of dabbling here and there with small Java utilities and one large Access database I wrote for someone, and some ...
0
votes
3answers
124 views

Is Perl used for web development? [on hold]

I am a web developer. I have been using php for many years and I also know lots of other programming languages so I wanted to try making websites using them. I know Perl and want to make a website ...
-1
votes
0answers
29 views

Expired domain APIs [on hold]

I'm looking to see if I can locate some domain API's to allow me to search for keyword related expired domains. I have some of them like domainsbot, domainr, and a couple of others. But those seem to ...
-1
votes
0answers
12 views

External entities not working in simplexml [migrated]

I am parsing XML using SimpleXML in PHP 5 and external entities are not working. The XML parses, but the entities just are blank. The underlying library is libxml2. This is the code: ...
0
votes
0answers
66 views

Executing a script continuously

I'm currently working on a PHP script that receives emails sent to a specific address and replies according to their content. It's working great, but now I need it to be executed every 10 seconds. ...
-1
votes
0answers
25 views

deciding how to populate a form [on hold]

I have some experience with PHP and learning Jquery/ajax. When it comes to populating forms, should I do all the data handling through a rest API and jquery? For example, I could do something like ...
-1
votes
0answers
40 views

PHP variable access across the files [migrated]

I want to get one page variable values to another page. Is it possible to do with $GLOBALS? or else how should i do? I have a variable $url = 'http://' . $_SERVER['HTTP_HOST'] . ...
0
votes
0answers
43 views

Should URL params and request params be stored in the Request object

Is it acceptable if GET parameters don't reside in the Request object, but in the URL? I am writing a small library in PHP, which is to represent the Request/Response as different entities and ...
2
votes
3answers
111 views

Extended usage of an exception

I'm in the process of building a routing system for learning purposes and have encountered an issue which I think is a bit in the grey area of best practices. Can you guys help me decide if this is ...
-6
votes
0answers
76 views

I am new to programming,recommend books and topics to cover to become a better programmer [closed]

I am 18 and started coding now which I really feel is late,coming to the topic.I just quit my college I am interested in creating bots,forums and website building and even building Android and I phone ...
-4
votes
0answers
73 views

What do you think about a CMS similar to WordPress but implemented in Java? [closed]

I am a Java developer and I am also interestest in WordPress CMS (it is a very popular PHP product, I think that all know it) website development. In this time I am working in Java on LifeRay webapp. ...
0
votes
0answers
10 views

PHP Netbeans coding style configuration, where is it? [migrated]

I want to standardize coding style accross all the developers computers in my office, I want to export my netbeans configuration and ask the other programmers to import it on their IDEs, do you know ...
-1
votes
1answer
126 views

How to pay the users of my website according to the number of clicks they get on the ads placed on their page [closed]

I want to make a website where A user can login and put content on the website and a google or Chitika add will be placed automatically on their content. According to the popularity of the content, ...
-1
votes
0answers
10 views

Unable to retrieve result data [migrated]

I'm trying to retrieve a set of rows through a query. I am able to retrieve the number of rows using $query->num_rows(). However when I am trying to retrieve $query->result(), I am unable to ...
0
votes
0answers
12 views

Edit files on multiple domains on Mambo CMS

I have multiple domains on same web server, all running on Mambo CMS. Each site uses same template and has roughly same site structure. I need to edit the same page on each website - is there a ...
-1
votes
1answer
89 views

using node.js server with mysql-module and PHP for a penny-auction website?

I'm building a penny-auction platform like DealDash and just read into the WebSocket and node.js topic. I used PHP, MySQL and Ajax to build the website. I'm nearly finished and just have to implement ...
0
votes
1answer
77 views

DI container with multiple instances of same object

I'm looking for idea to make a DI container that can store multiple instances of the same object. Usually, a DI container should store either a single instance of the object, or create new object each ...
0
votes
1answer
86 views

Upgrade object in PHP

I cannot find information on this anywhere so I assume it doesn't exist. It makes much sense for me for such functionality to exist and I want to ask whether it actually does and I am wrong in my ...
0
votes
1answer
85 views

DRY principles vs local-only variable scope in functions (PHP motivated question)

I'm new to programming and in particular new to PHP. I often find that DRY is directly opposed to the principle of keeping variables local in PHP functions. Sometimes I think that it's easier to ...
-1
votes
0answers
20 views

How to distinct vector classes and native classes in PHP autoload? [migrated]

How to distinct vector classes and native project classes in PHP autoload? see a part of the file and namespace structure: app/ app/Models/ app/Models/User.php app/Contoller/ app/Contoller/Login.php ...
0
votes
1answer
125 views

Best OOP practice for object vs dataservice [duplicate]

I am working on a new project and am curious as to how I should go about doing something properly. Lets say I have a table called "leads" in my database. This clearly means that a single "lead" would ...
1
vote
1answer
212 views

How to avoid big class complexity while keeping encapsulation?

I'm developing a PHP library to work with big numbers (at this moment only with a "Decimal" class, but I want to add new classes, to handle Integers, Rationals, and Complex numbers). In any case, the ...
-1
votes
3answers
55 views

What is an initial skeleton of the website called? A Framework? [closed]

I am building a website but I am wondering can I call the initial set of pages a framework? Say I have a project to build a website for a school. Before I start implementing the requirements I have ...
8
votes
2answers
327 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: ...
4
votes
3answers
84 views

What is Black Box Testing? Are Functional and Usability Testing its types?

I am writing about testing and I am confused about the following: What exactly is Black-Box testing? Are functional testing and Usability testing two different types of testing and are they types of ...
0
votes
1answer
45 views

PHP Composer vendors licensing

I'm using a composer as a dependency manager for my PHP project. Composer operates as a library, which uses packagist as a software repository to fetch third-party dependencies. I'm interested, ...
1
vote
3answers
198 views

PHP: is read file at every page load too heavy?

In F3 Framework Controller I wrote a function checking whether MySql data are saved in a file, otherwise loading a form to ask users for that data (similar to Wordpress Installation). This function ...
-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 ...
0
votes
3answers
120 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 ...
2
votes
1answer
187 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 ...
1
vote
1answer
111 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 ...
0
votes
1answer
56 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 ...
0
votes
1answer
84 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 ...
0
votes
1answer
71 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
0answers
25 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'. ...
2
votes
2answers
143 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 & ...
1
vote
5answers
350 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, ...
4
votes
3answers
166 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
0answers
53 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
2answers
287 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 ...
0
votes
1answer
108 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, ...
0
votes
1answer
109 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
vote
2answers
114 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
70 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
1answer
94 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
106 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 ...