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.

learn more… | top users | synonyms

-1
votes
1answer
23 views

which is best: simple approach or late static binding [on hold]

I have create two programmes with different approach. Both has same output. which is best? Late static binding ...
0
votes
2answers
47 views

PHP program which extracts attribute lists from custom tag

PHP program which extracts attribute list from the custom tag. It also strips out the single and double quote if it exists around attribute value. ...
0
votes
2answers
30 views

Lookup class to get descriptions of values

Following yesterday's advice on my Customer class, I have now created a new class which is for looking up descriptions from a MySQL database. I have a Lookup table which contains type, name, value, ...
3
votes
1answer
152 views

Simple SQL query using a class and function

welcome to my first post :D I have been writing PHP for a number of years but in a procedural style. I have always shied away from object oriented PHP because I just didn't understand it. However now ...
1
vote
1answer
73 views

PHP Class code that allow developers to register taxonomies in a CMS

Building complex applications can sometimes be a pain when extending or editing later on; I read online about the S.O.L.I.D principles of OOD, I want to understand if I am following a good approach ...
3
votes
1answer
52 views

PHP class which preserves line break by splitting the line into as many line break as it have

Can anyone here please review my PHP code which preserves line break by splitting the line into as many line break as it have? ...
0
votes
2answers
364 views

How to use PHP Visibility method?

At my new job, with new young developers, we are seriously discussing improving code structure and performance. (They keep more than 80 lines of code in a method). However I've read more tutorials, ...
1
vote
0answers
54 views

A Search Engine Class

I've built a Search Engine class for a website that permits to search companies in base of their locations and their categories (companies pay a plan to be found in the places that they will). In the ...
-1
votes
1answer
62 views

Authorizing users for POST requests

I've to authorize some users to do POST requests from their CMSs in order to create a new resource on my database. I've to send a JSON response containing the status of the response (successful or not)...
1
vote
1answer
41 views

Forum project using OOP PHP

I've been developing a forum as my first OOP project, I've successfully built a login/registration and other functionality typical in forums. I'm looking for some guidance in terms of where to take ...
1
vote
1answer
28 views

Validation of uploading images and adding records to the database

I am doing a php project with the codeigniter framework. In my controller, I have a function that does the following. Uploads an image to the server Add a row to the database. The data would be ...
2
votes
0answers
47 views

PHP/MySQLi code for registration/login form

The following code works, I just want to know if there are any suggestions as to how I can make it better or more secure. Thanks. config.php: ...
1
vote
1answer
32 views

Bulk customer creation

Here is my script which takes 50k records from a CSV and does CRUD operation with them. Unfortunately there are a lot of issues with the performance. CSV fields are: msisdn, resellerid, product ...
2
votes
1answer
121 views

Using PHP's password_hash and password_verify for a login function

This is my first time using password_hash and password_verify in PHP. Would this be the correct usage of ...
0
votes
1answer
57 views

Inserting a role using PDO

My question has to do with : (a) Can this be made more secure? (b) Are there best practices in relation to setting timezone? (c) What best approach should be taken defining use of utf8? ...
3
votes
2answers
256 views

Get number from N

I'm trying to find the shortest and best way to achieve the following: Given input integer $N, get the following output: n = 0, output = 0 n = 1, output = 0 n = 2, output = 10 n = 3, output = ...
3
votes
3answers
86 views

Scrape HTML into separate files for each chapter

I have written a program to read HTML file, find particular text, write text from that particular text to next particular text in a newly opened file. I am interested in code review. I am very new PHP....
1
vote
1answer
65 views

Mapping a product its corresponding image file

I'm writing this method that elaborates an image name.. I think my logic is not being the best one here but I'm not very savvy in programming yet. Right now it looks like this: ...
3
votes
3answers
101 views

PHP form validation for name, email, and Twitter handle

Given the following input values from a form, create a method or methods to validate the input based on their requirements. Throw an exception if any data is invalid. 1.1 ...
5
votes
1answer
66 views

Multilanguage class that detects and sets language

I have been learning object oriented programming for quite a while. I understand many concepts about it but I quickly realized that I made a big mistake just reading theory and not doing any actual ...
3
votes
1answer
47 views

Nesting a flat array in on itself

I have an extremely large function for turning my database output of menu links into a multidimensional array that nests each of the links in a menu fashion. I'm wondering if anyone sees a way this ...
2
votes
1answer
80 views

OPP Sign In/Out procedure in PHP

As a self-taught student of Web-Development and Web Technologies, I created a simple sign in/out form in PHP, just for practice purposes and some fun! I read the O'reilly's book about PHP and I found ...
3
votes
1answer
86 views

Simple Notification class that models database

I'm updating a website I made awhile ago from a functional design to an OOP design. There are still a lot of functions below this class that I haven't implemented yet but I'm getting to it (such as <...
0
votes
0answers
32 views

PHP FormBuilder class

I've taken some suggestions from this question and tried to build my own FormBuilder class. It's supposed to work like this: Creates an object of type form ...
1
vote
1answer
46 views

Updating register_globals code for importing $_GET and $_POST data

I'm updating a bunch of PHP code that relies on register_globals and uses request data globally. In the process of fixing/updating I spend a lot of time writing ...
1
vote
1answer
32 views

Calculating a quality score of something based on attributes

I'm willing to have a way to calculate a quality score of an object; in this case an addressbook contact. I believe there are way better approaches to do this and I'd like to hear your references. ...
2
votes
1answer
101 views

Class that generates records after performing business logic

I wrote a small class that does a database lookup and it generates a collection/Array. The Collection is resorted based on values returned from the database. Finally, the records can be retrieved ...
3
votes
2answers
76 views

Classes, one responsibility principle and magic methods

I am currently building a small application that allows users to create a slideshow, each slideshow consisting of slides that are either videos or images. Although this will be relatively small at ...
2
votes
3answers
150 views

PHP page pagination

I think my code is sloppy can anyone give me advice to do it better? This is a page pagination that get rows from mysql db and calculate the number of pages. ...
2
votes
1answer
186 views

Secure array encryption and decryption

I have written the below class which encrypts and decrypts a PHP array. The encrypted data and the hash are sent over an insecure connection and I would appreciate if you could check the code for any ...
2
votes
1answer
123 views

Regular Expression for parsing PHP annotations containing multiple lines and markup

I am writing a regular expression for parsing PHP annotations in a flexible way. I'd like to accomplish all the goals listed above with one single expression. So I would appreciate any suggestions ...
1
vote
1answer
97 views

A form builder component

I would love my component to be reviewed. I am looking forward to responses mainly answering the questions: Is my code violating the SOLID principals? If so, where and how? Does my component contain ...
1
vote
1answer
68 views

Reorganizing a PHP array structure (arrays within arrays)

I have this array within array which contains a lot of values: ...
4
votes
1answer
240 views

Reading XML files from RSS of different websites in PHP

I've created a working XML RSS reader. I wanted to know if it's a good one or not and if it's efficient for the server or not. I run this code every 12 hours or something give or take the amount of ...
2
votes
0answers
50 views

Nginx rewrite optimization for PHP execution

I've posted an excerpt from my Nginx configuration with the hope that someone can give me advice on anything I've done wrong or could do better. Please note that the below config works, but has been ...
2
votes
0answers
76 views

OOP Web scraper using regex to grab tag contents

I'm about learning about implementing the solid principle in PHP. I want to create simple content crawler/grabber from some websites. This crawler will grab the content from the website url. Since we ...
4
votes
1answer
146 views

Database connection wrapper class

I am trying to create a PHP / MySQLi wrapper class that uses prepared statements, the goal of the class is to create a connection to the Database, then INSERT / <...
2
votes
2answers
230 views

Selecting results as a comma-separated string

The below code is working correctly, however, I am not sure if the combination of while, foreach and ...
1
vote
1answer
47 views

Including a header file with proper content and structure

I am new to HTML and programming in general and am currently working on setting up my first website. For this I created a couple of PHP pages with a separate file for each of them and in order to ...
5
votes
1answer
216 views

Website user password verification

I have a login web page where a user enters their email and password and I need to check if: the entered email exists in the DB and the entered password matches the hashed one from the db. The ...
4
votes
0answers
166 views

Write a HTML table from MySQL tables

I have a piece of code that generates some tables: bp_rows: where I take a snapshot of some "headers" for each row of the table. ...
2
votes
1answer
133 views

PHP connector for communicating with a REST API (Part 1)

I wrote a PHP connector that will allow me to communicate with a REST API. This is the first time I am trying to make my code as clean as possible. I want to help myself learning how to better code. ...
4
votes
3answers
69 views

Database select script

Is there any way I could improve this script, such as by writing it in fewer lines (more efficient)? I'm very interested in keeping my code dry and fast! Also, if there is a way to make it more ...
6
votes
2answers
503 views

Routing for a Laravel 5 e-commerce site

I am new here and learning Laravel 5 on my own. I want to get reviewed on the following routes.php code. My question are: Have I made any mistakes by doing this? If yes, then what could be the ...
4
votes
1answer
243 views

Router for personal use

This is router I created for use, however, I wish to refactor this code and make this more robust. I would really appreciate anyone who can: Point out how to make this code more robust, clean and ...
2
votes
0answers
64 views

Configuration class

This is my first serious programming effort, so I'd like some comments about what I did so far. Project structure: ...
4
votes
2answers
219 views

Allowing googlebot to crawl a password protected page

The below I have put together as an experiment, I have profiles on my site that are password protected. I would still like them to be crawled by google. The script is taken from here and basically ...
0
votes
2answers
559 views

Shuffle Symfony entities

I've got an object $contest which is a Symfony entity that has some other entities assigned. I can get them by ...
1
vote
0answers
178 views

FilesSynchronizer: Synchronize local and remote filesystems

I have written a library that syncs files between two filesystems. It works fine, but I'd like some other developers to have a look over the existing code. Maybe I can optimize something. It is using ...