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

learn more… | top users | synonyms

1
vote
1answer
38 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 ...
-3
votes
0answers
14 views

PHP Ajax error, get 404 when type first char [on hold]

I see error in my console it says: showHint is not defined, while I defined it already, also this live search doesnt return anything when I type it. It assume should work like this. gethint.php ...
-1
votes
0answers
37 views

Best Local PHP database for beginners [on hold]

What is the best local PHP database that beginners can use, I don't have internet at home and I would like to learn how to use PHP and run a database locally, Is there any application that has the ...
-7
votes
0answers
27 views

how to resolve unwanted image tag [on hold]

can somebody please help me how can i remove this link to get featured when ever some body shares the web link on fb then this smiley image get featured what can i do to remove this image to get ...
2
votes
1answer
82 views

Creating variables in methods/functions

In how far do we create variables in our methods or functions? Do we only create one when we're using the result of the variable more then one time like this? function someFunction(SomeClass ...
2
votes
1answer
67 views

How to design database tables for a Factory class?

How can I design database table structure for a class that varies in its core parameters, when it is created by a factory method? I have a Factory like this: class ProductFactory { public ...
-1
votes
0answers
21 views

PHP in_array or array_unique? [on hold]

What would be the best solution here? If there are less then a 100 items in $list? And what if there are more then a million? Example 1: <?php foreach($list as $item) { if(!in_array($item, ...
1
vote
1answer
42 views

PHP MVC Display many records - model logic

I bet this question has been asked already but I can't form my thought as you can see from the title, so I couldn't find anything. I am working with MVC for quite some time now and I'm pretty happy to ...
0
votes
1answer
41 views

Database properties as Interface Constants in PHP [on hold]

I bought a PHP Design Patterns book, and the author uses constants to hold connection attributes: interface IConnectInfo { const HOST = "localhost"; const UNAME = "root"; const PW = ...
-5
votes
1answer
39 views

PHP Script to run from MySQL [on hold]

I have a PHP script that sends email only. My objective is that, on the 5th of every month, this script will be executed from my database and emails will be sent.
0
votes
1answer
61 views

Condition before statement or statement in condition

I've come across this problem a few times: Is there any "programming rule" for checking for an condition (error checking for example) before you want to do execute code, or only execute the code when ...
-3
votes
0answers
30 views

PHP Based algorithms for research [closed]

I am PHP programmer (Experienced ). Now i want to research in PHP algorithms and want to write a paper on a specific PHP algorithm. I need help : From where to start. What should i do . Some ...
1
vote
0answers
57 views

Successful use of Hack-PHP on large/enterprise projects [on hold]

It's been about 5 years since first initial (and probably Facebook's internal) release of HipHop Virtual Machine and about a year since Hack Programming Language was considered stable. Considering ...
-1
votes
1answer
41 views

Interchangeable array-object syntax

In PHP you can neither access an Object's properties with the array-syntax, nor array-values with the object-syntax. Is there any reason behind that? Why are not they interchangeable (Preferably like ...
-1
votes
0answers
21 views

What's a common approach to email notification digests (e.g. weekly summary of activity)

I'm trying to devise a process of sending daily, weekly and monthly emails. Here's what I'm thinking at this early stage: A database table "notifications" with columns: id (PK), type and data (type ...
-1
votes
0answers
20 views

Recommendations for PHP IOS push notifications library [closed]

What is the best library to use for iOS push notifications from a PHP server? So far I found two: https://code.google.com/p/apns-php/ https://github.com/adobkin/php-apn Any recommendations?
0
votes
1answer
43 views

How can I program the script on my server to the receive a cname pointed to it?

I am in the final stages of creating a mobile responsive customer relations management platform. Presently it is written in php as a stand-alone self-installing script. I would like, however, to ...
0
votes
0answers
32 views

Login Tokens Remote DataServer for use in a Javascript/HTML-PHP environment

I've asked this question on stackoverflow, but i think this is a more appropriate place for it. I'm creating an app for iOS, Android and the Web. I created a separate Restful Data Service that is ...
5
votes
1answer
110 views

How to use OO Design to Refactor a Library with Functions that are specific Product-aware

I have a class that acts as a library of functions for various products. To compute its data, the function currently needs to be aware of all product names. Depending on which product calls the ...
1
vote
0answers
41 views

Downloading a LinkedIn Users CV using the LinkedIn REST Profile API [migrated]

I am wondering if it is possible to make a call to the LinkedIn API using PHP that will allow me to GET the users uploaded CV. Currently I'm working on some basic API calls that have enabled me to ...
0
votes
0answers
28 views

PHP to stream live audio from server [closed]

How could using PHP one can make a server side script that will stream live audio from the mic of the server and so the client at browser can simply play via browser. Is there any possibility to ...
0
votes
0answers
31 views

What could possibly be a Mysql database structure for an web app say like Flurry?

Simply say, I'm working on a web App say like Flurry (http://www.flurry.com/), that would communicate with a Smartphone App trough API. Right now I'm designing the database structure, and I guess ...
-2
votes
0answers
30 views

Which is the best tool to automate [closed]

What are the best automated testing tools can be adopted for small projects (using php). Since I am using agile development, I need to automate the my projects, 1. There are many tools which is the ...
1
vote
1answer
75 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 ...
-7
votes
0answers
59 views

Is it possible to submit expired information and make the website believe it was submitted in time? [closed]

By expired information, I mean I was supposed to submit information within a given time limit, but I exceeded it by like an hour.When I submit as is, I get an error that I ran out of time.How can I ...
2
votes
1answer
81 views

What should be the structure of a person to person store database?

I am going to create a person to person store with Laravel, a website where its users can share and sell their product or their mobile, TV, Computer, Shoes, Shirts, Books, Cars, Bags, Animal, etc. I ...
-3
votes
0answers
50 views

How to crop text within HTML but leave markup (e.g. span, img tags) intact? [on hold]

I have something like the following HTML content: <div class="rteleft"><h2></h2></div> <p>If you're looking for a beach holiday in Japan then there are few, if any ...
-4
votes
0answers
30 views

PHP - What is the automatically generated .XML.cache file inside the cache folder? [closed]

I have a CMS which is written in object oriented PHP. The system has files, temp, langs, template, cache, ... directories with a MySQL database. When I run the index.php of the system, a file called ...
2
votes
2answers
119 views

Can a class method be accessed both in an instance and statically?

I am relatively new to class design and I have a task that I'm not sure how best to complete, or whether my idea in general is a code smell. I'm developing a RPG where people can own monsters, so ...
0
votes
0answers
3 views

cannot set project's JavaScript Build Path in PHP- eclipse [migrated]

Completely new to eclipse-PHP-javascript. I have created a php project in eclipse and trying to set up the javascript Build Path after enabling javascript support for the project The problem arises ...
2
votes
2answers
115 views

Should I use a large if statement inside a view or create a different view entirely?

I'm using the MVC architecture Laravel 4.2 to create a relatively complex web application. This application consists of a website which is very heavily based on whether an event has occurred or will ...
1
vote
1answer
50 views

Documentation of interfaces

I know how to document a function: /** * Prints a greet message to the web page */ function greet() { echo "Hi!"; } Or describe the usage of a variable: /** * @type string $name The user's ...
0
votes
0answers
34 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
0answers
30 views

How to pass user credentials to dovecot without storing it in the API

I have developed an interface to dovecot IMAP server using 'PHP IMAP' library. I wanted this interface to be standalone and thus it might have deployed outside the mail server. I used to test the code ...
2
votes
2answers
113 views

What is the best way to create REST API error response model and error codes system?

My REST implementation will return errors in JSON with next structure: { "http_response":400, "dev_message":"There is a problem", "message_for_user":"Bad request", ...
1
vote
2answers
189 views

Best approach to develop / distribute proprietary module

I've been brainstorming for a while regarding the best approach to distribute closed-source modules. I'd like to mention that I have found similar question(s) on SE sites but don't think this is ...
0
votes
0answers
45 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
1answer
28 views

Scoping template variables in “has-a” (compositional) relationships

I'm developing a new templating language for PHP, and one of the features is an object-oriented approach to nested child templates. For example, I can declare an object of type HtmlBuilder like this: ...
1
vote
1answer
218 views

Why does PHP allow sending mail from any address

I'm sorry if this has been asked but I'm not quite sure how to search for it. I'm having a bit of trouble understanding how mail() works in PHP. The way I see it, using that function, I can send ...
0
votes
1answer
62 views

Possible to refactor these methods that contain the same logical flow?

I have many methods in many repositories that have the same logical flow: Retrieve value from Cache Check value If no value, fetch from Database Update Cache Return value Is there a way to ...
1
vote
1answer
143 views

The correct manner in implementing an email notification system

I'm looking to build an email notification system using codeigniter. Now the system in question is one of a 2nd hand online store. For example say person A would like a chair. When they search the ...
0
votes
1answer
87 views

Do I need Bower for front end dependencies when I am already using composer?

I use composer for PHP dependencies. I was under the impression that for front end dependencies I should use Bower. So, I installed Bower and loaded my FE dependencies (Bootstrap, jQuery) using that. ...
0
votes
1answer
96 views

Best practice for using namespaces in my PHP libraries

I've been using a tiny and neat caching library on my projects, but I realize that "Cache" is a very generic name and it's easy to get a collision when using it in large projects. Also, I would like ...
1
vote
0answers
65 views

PHP MySql - Statistical Reporting - Best Approach to query appointment system time utilization

I have built an appointments system for various medical practices. Practice schedule appointments - I am looking to provide analysis on the amount of time that has been utilised by the practice. I ...
2
votes
2answers
314 views

Should we refactor our existing codebase to use functional programming, especially streams? [closed]

We have a large project written in PHP. It almost exclusively uses imperative operations, as in example 1. Should we refactor our existing code to use functional operations? Do you think that the code ...
-5
votes
0answers
71 views

How do i compare PHP Efficiency between two algorithm? [migrated]

Here is two function that creates 1000 files inside 1000 folders in two different fashion: First Method function createEverything() { for($i = 1; $i == 1000; $i++) { mkdir('test/'.$i); ...
3
votes
2answers
120 views

PHP package management with/without Composer

I noticed that many (large) PHP applications use Composer for managing the dependencies. I'm currently trying to figure out if I should switch to Composer (at the moment I'm simply keeping my ...
2
votes
0answers
45 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
79 views

Continuous Integration for different languages [closed]

So, I understand Continuous Integration in theory, and have used Beanstalk. However, I've been charged with creating the process at my current PHP shop. My hope was maybe PHPCI, since it looked ...
3
votes
2answers
291 views

C# static practices coming from dynamic background

I have been dappling in C# after coming from several years in PHP. I don't find the language particularly difficult, although there are considerably more constructs for me to get used to. My question ...