PHP is a widely-used, general-purpose server side scripting language that is especially suited for web development.
3
votes
2answers
46 views
Can this class be improved?
I have this class whose code I pasted in full. The CredentialsManager class is not shown here as all it does is return the DB connection variables. My question is if this class can be improved or if ...
4
votes
2answers
53 views
Check if the jQuery library is present locally
Q.
Basically this piece of code appears in my class constructor. It's working, but it seems very confusing.
It basically checks if the jQuery library is present locally and if it's not it will try ...
4
votes
8answers
51 views
Is there a better way how to force file download than using this simple PHP script?
I've written this simple script to force download some files (jpg, mp3, usually those which are loaded in browser by default).
I was wondering whether there's any way this could be improved upon, ...
2
votes
2answers
68 views
A PHP MVC working with Mustache (and now nested templates!)
So I try this site for the first time, I hope I'm not off-topic [as I also have an issue in my code]=> Not anymore but I'd love some feedback about this code that I'm editing and shortening now.
...
3
votes
1answer
51 views
PHP: PDO (mysql) basic usage, query variable naming conventions (etc)
After mseancole's answer
I just realized that I was using json_id for 3 of the 4 queries after reading mseancole's hint about putting them into an array. Neat!
Are there more improvements I could ...
1
vote
3answers
43 views
PHP - Deleting Directory Contents & SubDirectory Contents
I've set up some PHP to delete a directory, it's contents, and any subdirectory and its contents... I'm new to PHP so I'm most definitely doing something WRONG or am doing something in the most ...
-3
votes
0answers
30 views
How to prepare my PHP script to send SMS from a website [closed]
I have tried to prepare my PHP script to send SMS from a website several times, but I always failed, and once I even made such a mistake that my employer almost appointed another developer for my job, ...
3
votes
4answers
92 views
Refactoring a class hierarchy to remove subclasses
I have the following class inheritances hierarchy:
First the abstract parent class:
<?php
abstract class SegmentParserAbstract{
/** @var ParserResult */
protected $_result;
protected ...
2
votes
3answers
93 views
Extremely basic authentication class
I'm in the process of building a small application and obviously I need some sort of way to authenticate users. I'm not sure if I am way off or if this is close to what I should be thinking. Please ...
0
votes
0answers
20 views
optimized way of checking and assigning a function boolean [closed]
Possible Duplicate:
php ideal way to check function returns true
Which of the following way of checking whether a function returns True or FALSE is best, in terms of efficiency and code ...
6
votes
3answers
264 views
PHP ideal way to check function returns true
Which of the following way of checking whether a function returns TRUE or FALSE is best, in terms of efficiency and code readability?
I was told by a friend that Method B is a good practice, but I ...
-2
votes
0answers
25 views
Need help in php how to accept one time coupon code and validate it from a list [closed]
I need help in php, I'd like to accept a coupon code in a Wordpress page then check it a from a list, once it's validated it will redirect the user to another page and will delete the used code in the ...
2
votes
1answer
55 views
Can someone more experienced with MVC routers, review my RequestRouter::dispatch() and Request::parseURI() methods?
I'm hoping that the more experienced devs here can help me improve these methods. I'm building a basic MVC framework for myself (as a learning project,) and I'd really appreciate your insights. Things ...
2
votes
2answers
82 views
Basic Database Class with PDO functionality
Is my following (very basic) class considered good use for PDO integration?
Or is there a better, more efficient way?
class Page {
public $title;
public $db;
public function ...
2
votes
0answers
22 views
Validation and Error Generation when using the Data Mapper Pattern [migrated]
I am working on saving state of an object to a database using the data mapper pattern, but I am looking for suggestions/guidance on the validation and error message generation step (step 4 below). ...