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

learn more… | top users | synonyms

2
votes
0answers
19 views

PHP function to convert a Portuguese word from singular to plural

I know, this sounds really difficult, but it is really easy. I needed to convert a single Portuguese word in the plural into singular. I know there's a right name for that, but it is escaping me. ...
1
vote
0answers
13 views

Implementing Multi Language (Internationalization) Functionality in CodeIgniter

Background My website purpose is to sell online English lessons to people in Europe. It is crucial that my site is multilingual. Overview I am using HMVC modules to organize my site and my website ...
2
votes
0answers
22 views

PHP Validate JSON objects with a JSON schema

I have a basic JSON API written in PHP. I want to validate incoming JSON data. I know there are PHP JSON validators out there, here is a quick one I just rolled up. ...
-1
votes
0answers
18 views

Fetch internal and external links count from a webpage with PHP [on hold]

Here is my code which is a partially based on a few different codes that you can find easily in various places if googled. I'm trying to count the internal and external links, all links and (...
1
vote
1answer
20 views

Laravel makeHidden (how to use)

I am using Laravel 5.3, and currently working on models. I have the following code: ...
-4
votes
0answers
23 views

how to sort and count occurrence of character in c++ [on hold]

how to sort and count the occurrences of character ? below i try to make an algorithm buti dont know to count the occurrences thanks :) ...
0
votes
0answers
14 views
0
votes
0answers
6 views

Checking if an array key contains a value? [migrated]

I have an array, I want to check if the keys have '-main' after them. ...
0
votes
2answers
30 views

PHPUnit test for a PaymentMethodRuleManager

The following code snippet is about adding rules that filters Payment Methods listing to customer, for email we provide 4 different types of payment methods, but we do show them depending on some ...
-4
votes
0answers
22 views

PHP SignUp and Validation [closed]

I have created php signup page and it was working fine until I add Validation, Then I found out that it saves data into database despite wrong info, As if I didn't add Validations. Thanks http://...
-3
votes
0answers
19 views

Php script to search data by name. (Filter search) [closed]

It's me again. :) I want to display hospital names from database by two ways. (i) selecting city or (ii) by entering the name of hospital in search bar. I wrote this php script. The 1st part ...
0
votes
2answers
52 views

Nested file_get_contents / json_decode

I have this code but it takes over a minute to run. I'm looking at around 400 entries being brought back for the first loop. Any ideas on how it could be improved for speed? ...
-4
votes
0answers
11 views

How to conver Mysql to Mysqli in exporting php to csv [closed]

Can someone help me to convert this following code to MySqli? Just a novice about this. Thank you! This is my code export2csv.php ...
-3
votes
0answers
20 views

Saving Forwarded URL Parameters to MySQL DB using PHP [closed]

I have a site where customers send bulk SMS, so I forward the SMS request to Aggregator and he delivers the message through Mobile Operators in India. Now, the issue where I am facing is. Once SMS ...
0
votes
1answer
54 views

PHP Error Class

I have coded a very simple error class that will allow me to display errors if they should happen. For example, if a file is missing or a database connection couldn't be established I would display a ...
1
vote
1answer
50 views

Compares times between players in CS:GO

The program is meant to compare values between the two datas given and see who has beaten the map faster and by how much. Formatting is set to MM:SS:SU. It looks REALLY sloppy right now and I'm sure ...
0
votes
2answers
48 views
2
votes
1answer
71 views

OOP PHP for handling upvoting

kinda new to OOP, and I wanna know if i'm heading into the right direction. Also I should mention I'm not using AJAX AnswerVoteManager.php ...
1
vote
2answers
78 views

One object to handle all my database manipulation needs

I have created an object to handle all my database manipulation needs. Here is my object constructor and one of its functions: ...
0
votes
1answer
34 views

Functional test with PHPUnit / Symfony

I am trying to test my first functional tests. I would like to know if my functional test is well done, or if the structure of it is not optimal. Any advice will be useful to me. As I said, I just ...
3
votes
1answer
66 views

Check if relations exists for a parent node before deleting it so that we don't have any orphan child node

Here I am trying to delete a parent node but only if it doesn't have any child node. Please review this code. PostController.php ...
0
votes
2answers
45 views

PHP script to generate hreflang tags

I'm currently working on a website which provides content to users based on their region. As a result the website has subdirectories for the appropriate regions. For example, a pricing page would look ...
1
vote
2answers
84 views

Validator Class in PHP

I am trying to create a validation class that can be used to validate many forms of my webpage in general. It makes use of the database as well to verify records. The problem with it is that it ...
3
votes
2answers
70 views

Creating a model record for a database

I'm trying to expand my use of classes and better understand how/when to use them. Please review the code and let me know if I'm on the right track or where I need to make improvements. For example, ...
2
votes
2answers
55 views

Register page for website

I've been working on a simple forum website as a toy project, to start learning PHP and SQL. I've implemented all of the functionality I want, but I thought I'd run the code by the Code Review ...
1
vote
0answers
79 views

Email thousands of customers from a PHP form using a MySQLi query on a MySQL database

How can a large internet service provider email certain customers to warn them about an impending service interruption? I'm providing what I think is a reasonable solution, but I have not tested it. ...
2
votes
1answer
124 views

Auto loading code

I'm new to PHP and I didn't know there is something called coding style standards. Now I'm trying to stick to PSR coding style standards and after reading PSR-4, which is about autoloading standards. ...
0
votes
0answers
38 views

An attempt at a cookie wrapper

This an attempt of a cookie wrapper of sorts. It has no real purpose nor do I encourage anybody to every use it in a production environment. It was made for fun, at best for practice. The purpose is ...
4
votes
1answer
70 views

PHP, MySQL quiz application

I'm working on a quiz application for training purposes and I think I'm done with most of it. However, I'm not comfortable with what I've done: it seems to be complicated and unprofessional and I ...
2
votes
1answer
52 views

Zip code reduce function

My task is to write a function that would take an array of zip codes and spit out only the zip codes that do not qualify. A non-qualifying zip code will not exist in the database and does NOT have ...
1
vote
0answers
26 views

Laravel 5.3 model for mapping pages to multilingual translations

I have a Many To Many Polymorphic Relation like this: ...
0
votes
1answer
100 views

contact.php file

This is my contact.php file which has only 2 functionalities: Response with the default page if it is requested by the get method Process the message posted by the ...
1
vote
2answers
99 views

My included in every script file

I wish I found this site 4 months ago when I started PHP, when I wanted the experts to check the engine and wheels before I take off. Right now I'm finishing my very first web application, and I will ...
0
votes
1answer
52 views

Searching in array by key => values

I need to write a function that searches the two-tier board according to certain parameters, which works, but I question whether there is a simpler, lighter way to perform this task. ...
0
votes
1answer
80 views

Calculating the difference between 2 arrays

I made this function to calculate the difference between 2 arrays and return it in a third array. I'm using this function as a part of stocktaking functionality I apply in my accounting system. ...
1
vote
0answers
51 views

Calculating the difference between two (incomplete) arrays

EDIT: a function to calculate the difference between 2 arrays I'm coding PHP for only 4 months, and I need your help to improve this code I have 2 arrays like this ...
2
votes
4answers
82 views

User Profile page - code quality , security & Performance feedback

once user login, we are displaying all the information of user in profile/account page. please check code quality , security & Performance. ...
0
votes
2answers
46 views

No getter/setter on model with many instance vars

I have been reading a lot of material on how to become better in OOP, DDD etc. While reading Object calisthenics and Getters/Setters. Evil. Period. I got confused. Let me explain it by example. I ...
1
vote
1answer
27 views

A localization helper in codeigniter

I created a project to better understand CI3, while developing it I tried to introduce localization elements. When I tried to localize the view everything messed up. I made a helper to identify if the ...
4
votes
2answers
62 views

Basic PHP Cloud script

I would like to add basic Cloud system to my website project. I have my php login system already included. Every person must be logged in to view this site. There are several session variables like <...
0
votes
0answers
27 views

Pagination with ElasticSearch results

Technologies being used: PHP 5.6 Laravel Framework 5.3 (with Blade templating) ElasticSearch 2.4.1 Bootstrap (for CSS pagination classes) ...
4
votes
2answers
103 views

PHP OOP Login Script

I'm new to both PHP and OOP and would like some constructive feedback on a class I made. I have a "main account" login system already setup and working; when the user logs in they're presented with a ...
-4
votes
0answers
30 views

pdo query innerjoin optimization

i need help optimizing this PDO query i would like to know if there is a better approach for this code and would like to make it cleaner and faster. right now it takes about 2 seconds to load one ...
-1
votes
2answers
56 views

Method to assign handle to organization object in one of multiple ways

I have a method that's called thousands of times during one process. Before optimization, it called the database on every execution. After optimization, it only calls the database when required. ...
3
votes
1answer
76 views

Populating a form with filtered hierarchical place names

My server performs a query to get all country data with Eloquent relationships: ...
0
votes
0answers
40 views

Zend Framework 3 Ajax Form Validation - contact form

I would like to present to you my code vision of Ajax form validation in Zend Framework 3. I am a beginner in Zend Framework and jQuery too, so I don't know that my solution is good and acceptable. ...
0
votes
1answer
58 views

Secure logout PHP code with cookies

I have the following PHP logout script and I would like to know the loopholes present in it. How can I improve it? ...
3
votes
3answers
33 views

Summing durations associated with each MAC address in a MongoDB result

I have a script which get data from MongoDB in the form of array and show the result. The array has a number of records in the thousands. A sample array is as follows: ...
1
vote
1answer
35 views

Class for creating save sessions in PHP

Is the following class well-built and secure or am I missing something? Any improvement ideas welcome. ...