Skip to main content
Code Review

Questions tagged [php5]

The fifth version of the PHP: Hypertext Preprocessor (PHP) scripting language. It features the Zend Engine 2, better object model support, and many other improvements over PHP 4.

Filter by
Sorted by
Tagged with
4 votes
2 answers
217 views

Security of post submission, picture upload and post fetch

I am a newbie and have been following a tutorial I bought on Udemy. But I was told it is old and teaches bad code practices. I used this in some code from my old projects. Now I'd like to know how ...
-3 votes
3 answers
394 views

Registration code [closed]

I was following a tutorial for a social network. I want to know how secure this code is because I plan on launching it to the public web. ...
0 votes
1 answer
265 views

PHP - Importing columns from uploaded CSV file to SQL database (Laravel 5.7) [closed]

The goal is to upload the columns from the csv into the SQL Pro database. I am able to select the column names that have been uploaded from the csv file, the columns from the csv file are then ...
1 vote
2 answers
770 views

Validate array elements in PHP

$elements is an array, which may contain 'x' or 'y' keys, I want to check if they exist, otherwise assign a 0. I'm looking for a clean way to validate it. I'm new ...
gogasca's user avatar
  • 609
3 votes
0 answers
53 views

Use a pattern for fields validation

I need to validate the fields of user sent by an API. All works fine but the only one problem is that I don't like the solution is not an OOP solution. In the controller I call the service created by ...
1 vote
1 answer
96 views

Merging and summing multi-dimensional arrays

I've found myself today really struggling with this subject and I'm pretty sure that there must be a better way to do this. First of all my arrays have the same layout, I need to merge them and sum ...
ccb123g's user avatar
  • 11
3 votes
2 answers
2k views

Users management php class

After a little bit of troubleshoots, I've finished this simple users registration and login class. It uses PDO to connect to a mysql database, I've tried also to ...
1 vote
1 answer
123 views

Appending objects to an array based on a field

I am working with PHP5 (Laravel 5.1), and I couldn't optimize my function, which takes more 4 minutes turning, and fails in the end when I have a huge data (around 6500 rows, but working when i test ...
Gothiquo's user avatar
  • 127
0 votes
1 answer
44 views

Quiz setting users grade

I have made this code to determine the users grade for a quiz. However I've just been thinking that maybe I could shorten the code somehow? as its just a lot of if and elif statements. ...
user avatar
user160133
1 vote
1 answer
74 views

Git Autoupdater

At my office we have an internal monitoring tool we use on customer systems to monitor various vitals and notify us via Slack. Our Lead Dev and Chief Architect are very paranoid about Git, and ...
Mayube's user avatar
  • 181
0 votes
1 answer
58 views

PHP return validate method of if one error is found

My method counts the number of times an error occurs. I have a feeling my snippet isn't the best practice way of doing this. So when one of the validation methods fails I want to stop the method. <...
Miguel Stevens's user avatar
1 vote
2 answers
2k views

Sync Server Time with User's Timezone

I have a web application which is being used by users from different parts of the world. In order for users of the site, to be able to view the timestamps in their local time, I've a settings page set ...
asprin's user avatar
  • 187
2 votes
1 answer
136 views

Function to insert a tag into a database

I'm developing a MVC structured RESTful API project (thanks to the help of Mārtiņš Tereško for explaining it). Almost all of my functions look similar to this: ...
1 vote
1 answer
179 views

Populate two arrays with two different SQL queries

I am using Joomla and connecting to an MSSQL database to store the resulting set(s) in arrays. I am utilizing this syntax, but there must be a more efficient way of coding this. ...
4 votes
4 answers
9k views

Which is cleaner: a constructor with many parameters or many setters after construction? [closed]

I'm trying to work out which is cleaner, having a large constructor or having to use many setters on a new object before doing some work with it. Large constructor: ...

15 30 50 per page
1
2 3 4 5
...
16

AltStyle によって変換されたページ (->オリジナル) /