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
79 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) { ...
-3
votes
0answers
23 views

How to use Multiple class in javascript function for testmonial? [on hold]

I Have Two Div I want Use this Class For Testmonial Show Please Tellme How I use 2 class in one Function.
0
votes
0answers
37 views

How to detect marks on a custom form [on hold]

I've created a custom form on paper that will be scanned. The form looks very similar to this lottery ticket form. I think there are several ways to do this. One of the things I've tried using is ...
1
vote
0answers
25 views

Android, PHP session and JSON object retrieval

I am working on an app in android studio.. it currently has a login and registration system that are linked to a database and both work perfectly. I am now trying to carry over the user id value ...
2
votes
1answer
247 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
25 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 ...
-4
votes
0answers
18 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 ...
0
votes
1answer
132 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 ...
0
votes
1answer
93 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 ...
1
vote
1answer
288 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
2answers
1k views

How can I learn how to use Smarty effectively?

I have some experience in PHP4, but after learning the object-oriented parts of PHP, I'm having difficulty understanding how to use the Smarty template engine. The official documentation appears to ...
0
votes
4answers
345 views

Is it better to find issues myself or let the computer figure it out?

I'm about to start the process of migrating a program from one component to another. Most of the core functionality will be the same but I'll need to change database calls, etc. I'm sure there will ...
0
votes
0answers
318 views

Which interface allows you to use a design pattern that is characteristically changed with the instantiation of objects?

I can't find my answer to this question: Which interface allows you to use a design pattern that is characteristically changed with the instantiation of objects? I found something related to ...
2
votes
1answer
79 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 ...
3
votes
2answers
4k views

How to become an expert web-developer? [duplicate]

Possible Duplicate: What should every programmer know about web development? I am currently a Junior PHP developer and I really LOVE it, I love internet from first time I got into it, I ...
0
votes
3answers
133 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 [closed]

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
67 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. ...
0
votes
1answer
110 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, ...
-1
votes
0answers
25 views

deciding how to populate a form [closed]

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 ...
1
vote
2answers
290 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 ...
9
votes
2answers
329 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: ...
2
votes
4answers
2k views

Can I test effectively javascript functions with a PHP unit-testing framework?

If I want to unit-test some of my javascript functions, would it be more efficient (and doable) to use the already installed PHP unit-testing framework, or should I use a javascript unit-testing ...
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 ...
-4
votes
4answers
2k views

How to not let anyone inspect elements of a webpage?

I was thinking to make some jQuery functions that will use ajax to control mysql. The whole idea is to make separate files of PHP (e.g query.php, addRow.php, update.php and delete.php) provide data to ...
-6
votes
0answers
81 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 ...
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
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 ...
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
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 ...
-2
votes
1answer
93 views

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

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
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
vote
1answer
170 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 ...
9
votes
2answers
1k views

How do I partially add PHP namespacing to a library without breaking existing code?

My company has created a modular PHP framework over the years, beginning long before PHP 5.3 added namespaces. Recently, we decided to start using namespaces in our library's new code, and we intend ...
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
169 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 ...
0
votes
3answers
345 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
215 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 ...
0
votes
1answer
101 views

Like structure table with Laravel and showing the most popular content at top

I am using Laravel to creating a website, my users can post questions and other users can write their comments under the post, each comment have Up vote and Down vote, and users can voting for ...
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 ...
11
votes
2answers
3k views

Static is bad, but what about the Factory pattern?

I'm on a TDD project, so I try to stick as much as possible to the good pratices involved with that kind of development. One of them is avoiding as much as possible static and global. I'm facing this ...
2
votes
1answer
238 views

MVC with Post/Redirect/Get

I have a question in mind for the MVC pattern for a long time now. When using the Post/Redirect/Get principle then it doesn't make sense to use ONE model in the sense of MVC, right? Why should I ...
9
votes
7answers
13k views

Is there any design pattern except MVC for web?

I want to know are there any design patterns for web besides MVC? I know there are design patterns as: Registry, Observer, Factory, ActiveRecord ,... and MVC a set of other design patterns and folder ...
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 ...
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 ...
0
votes
1answer
193 views

Creating a voting platform for submissions during timeperiod

I have a site where stories are submitted at any time by users. The staff would like the ability to create a voting period at any time. For example, they can choose to open up voting from today until ...