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

learn more… | top users | synonyms

0
votes
0answers
25 views

Understanding multi-threadiing PHP (pthreads)

I am trying to understand multi-threading in PHP using pthreads via reading this article: https://gist.github.com/krakjoe/6437782 , but all the concepts/terms are going over my head. Such as mutex / ...
-3
votes
0answers
26 views

How can i loop through string of phone number and remove the leading zero and replace with country code?

Example: I want to replace each leading zero (0) of the phone numbers with "233"; $pn_box='08064342060,08052031697,08064342060'; Though I tried doing it this way but it converts only the first ...
-2
votes
0answers
33 views

Where can I find an API that can understand the meaning of queries? [on hold]

Freebase is neat. It has all I need but unfortunately it's shutting down. I'd like to use an API that can understand the primary types of the queries that I'm sending not only by processing its ...
0
votes
2answers
46 views

What is the value of encoders with decoders currently present

Can you tell me the value of using PHP encoder (ioncube, phpshield) with currently present service like decry.pt (http://www.decry.pt/) that can easily decode source codes. I have tried decry.pt's ...
-4
votes
0answers
22 views

Enable php-phantomjs to use disk caching? [on hold]

Phantomjs has a disk-cache option that works when running via command line, but when I use php-phantomjs it seems that no disk caching is created, although I'm setting that option. Can it be because ...
-6
votes
0answers
26 views

How to make Online shop with quest/mission? [on hold]

Sometimes I Bored, What can i do?,but Reality I just a beginner programer ~ Now I want make new conception online shop with quest/mission like a game online can master help me? :(
-2
votes
0answers
29 views

Unicode Support and future versions of PHP [on hold]

PHP 6 was planed to enhance Unicode Support. PHP 7 roadmap does not address this as well. What will be happen for PHP regarding multilingual support?
-5
votes
0answers
25 views

Generate a dynamic dropdown and embed a php code [closed]

I want to create a drop down dynamically and display a data in to drop down from database. and when click on product from drop down I want show two textbox.
2
votes
2answers
223 views

Lesser of two evils regarding return types

I'm implementing a system in PHP where values are represented with objects that implement an Amount interface. I'm building two different implementations of this interface, one using a simple integer ...
-2
votes
0answers
21 views

Restricting file types when uploading to my server [migrated]

i'm currently working on a project for an IT class i'm teaching, so i've set up this page on my website where students can upload html files, so they can see what the final result is. How exactly ...
-5
votes
0answers
42 views

How to open Modal box after saving data to database and show result [closed]

I need to open modal box for showing the error message or success result after uploading data from CSV in mysql . Please suggest me how can I made it possible ? $res = true //if no error $res = ...
0
votes
1answer
63 views

PHP MVC how to access current user?

What is the best way to tell if a user is already logged in when accessing the page? I have seen many people talk about a Recognition service that will validate a user trying to login, but what about ...
0
votes
0answers
29 views

How to approach building an achievements system using redis? [closed]

We're building an achievements system based on the interactions a user can do on the website such as answering, following, agreeing with an answer etc... by achievement I mean answering 50 questions ...
0
votes
1answer
40 views

PHP Multi-Page / Session Question

I created index.php that basically looks up all the individual php files (articles) in a few subfolders and prints them out. Since the quantity of articles is over 30 and growing, I implemented a ...
11
votes
2answers
1k views

Is an NPath complexity of over sixteen octillion realistic? Or have I broken the tool?

I have just measured a large chunk of PHP code (1153 lines) using PHPMD (http://phpmd.org/) and it tells me the code has an NPath complexity of 16244818757303403077832757824. That looks like a ...
1
vote
1answer
48 views

Generic PHP web interface for handling concurrent updates optimistically

I'm looking in to writing a new PHP based CMS which handles concurrent edits optimistically like source version control rather than pessimistic locking like Wordpress. I want to be able to write some ...
0
votes
0answers
66 views

SQL Query based on URL [migrated]

I have a sql query which brings back information based on the Sessions Cookie. I want to make a link to a users profile and have a url like account.php?id=Danny Then i want to run a sql query but ...
0
votes
0answers
9 views

Unable to insert datetime value into a MySQL table using PHP [migrated]

I'm trying to run the following code in PHP: <?php require_once 'Admin/Connector.php'; $name = 'A Schandillia'; $number = '12345678910'; $latitude = '73.897687'; $longitude = '11.958271'; $sql = ...
1
vote
5answers
250 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 ...
0
votes
1answer
47 views

PHP and Subversion workflow [duplicate]

I'm working on a project in a small team at the moment working on a webapp. We originally had 3 on the team with a lead dev and now we've grown to 7 and a lead dev. At the moment our workflow is ...
1
vote
1answer
66 views

How bad is it that my index.php in a Zend Framework MVC application mixes definitions and side effects?

I'm introducing some more coding quality standards and checks via a new project - in particular, the PHP-FIG recommendations. This project using Zend Framework 2, and I have a fairly simple entry ...
0
votes
1answer
53 views

Development and testing PHP script that gets variables from external server

I have a web app that sends users to an offsite payment server to complete a transaction, and I'm working on the PHP page that users are returned to upon completion of the transaction. The script uses ...
1
vote
1answer
58 views

MVC, pagination, and massive search criteria

I am currently working on a project that has a fairly large search form - the form is 30 or fields or more. Now I can of course map this out for routing by having my application pull the parameters ...
0
votes
0answers
43 views

Class Interfaces with Multiple Classes and Dependency Injection

NOTE ON QUESTION TITLE: I did not really even know how to phrase the title so if someone can edit and make it more articulate I would really appreciate it. QUESTION: Basically, what I'm trying to do ...
0
votes
1answer
80 views

PHP - How to structure this application

Sorry if the title is leading.. I'm looking for advice for the following system I am implementing: The system is to provide quotes for customers, this is then exported to PDF and emailed to the ...
4
votes
1answer
111 views

Social network notification system

Background I am working on an app for a client that includes some social networking features. I was originally developing the mobile front-end, but circumstances have left me in charge of developing ...
-2
votes
0answers
27 views

PHP Static and Normal Functions Calling [migrated]

Can someone explain how these line of code are working class DemoStatic { function normalFunction() { echo "This is the normal function"; } static function staticFunction() { echo "This ...
1
vote
0answers
210 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 ...
0
votes
1answer
157 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
votes
3answers
163 views

Is Perl used for web development? [closed]

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 ...
0
votes
0answers
74 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
0answers
46 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
121 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 ...
0
votes
0answers
13 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 ...
-3
votes
1answer
143 views

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

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 ...
1
vote
1answer
99 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
91 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
87 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 ...
0
votes
1answer
128 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
283 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
68 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 ...
9
votes
2answers
346 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
111 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
49 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
218 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 ...
0
votes
3answers
126 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
193 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
59 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
89 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 ...