Tagged Questions

PHP is a general-purpose scripting language originally designed for web development to produce dynamic web pages. For this purpose, PHP code is embedded into the HTML source document and interpreted by a web server with a PHP processor module, which generates the web page document. It also has ...

learn more… | top users | synonyms

0
votes
0answers
29 views

Why is using a variable in a for loop faster than some function output? [migrated]

On Symfony blog, in support of Symfony being faster, it was mentioned that for ($i = 0; $i<count($my_array); $i++) is slower as compared to for ($i = 0, $count = count($my_array); ...
0
votes
0answers
23 views

User Authentication/Permissions for php MySQL CRUD [closed]

Just remembered CodeReview existed. I posted some code for review in the main forum but it may belong here. I dont want to double post so Ill link to it instead. ...
3
votes
1answer
13 views

User Authentication/Permissions for php MySQL CRUD

So I took my first stab at a user authentication function. I invented my own way of doing this. Is this a safe and efficient way of giving a user Read/Edit/Delete permission on tables in a MySQL ...
1
vote
2answers
85 views

Is there any better way to do this in PHP

Im using this way to load a combo box with branch names <select name="CmbBr" id="CmbBr"> <?php ...
1
vote
0answers
30 views

TinyMVC Model / Plugin how to implement?

Recently I started working with TinyMVC, wrote a simple menu model and I have few questions for those who are using it... or used before. For the following code should I keep it as Model or as a ...
0
votes
0answers
34 views

Does this code follow loose coupling pattern or should be refactored/re-designed?

I've to adming i don't like this design. The main class (SMSHelper) is responsible of query a REST web service which in turn returns an XML string. This helper is going to return a new SMSCreditInfo ...
1
vote
0answers
18 views

contract validation and responsibility without exceptions in the constructor

my question is based on this "principles" do not throw exceptions in a constructor single responsibility / seperation of conerns use logic exceptions for broken contracts and runtime exceptions for ...
1
vote
1answer
38 views

Sorting with combobox

i need some help from you :)...when we select 'info' list in the combobox,automatically the article with type 'info' charateristic showed up, and when we select 'Berita' list in combobox,automatically ...
1
vote
1answer
67 views

Pirate Bay name and magnet mailer

So, first time I try PHP. Thought I'd set a goal for myself, divide it up in smaller problems and start googling. So yes I got it to work, very happy. But, it is rather crude and ugly. So now I would ...
1
vote
3answers
61 views

Fail-safe remote API operations - best practices

I'm working with two remote APIs, one which manages customers, the other (a Paypal API interface) which manages billing. To delete an account, I must delete the records from both. function ...
3
votes
0answers
53 views

PHP simple encryption class. Am I using crypt and mcrypt well?

These days I read a lot here on SO about password hashing and data encryption. It's a real mess, I mean, deciding what the best practice is. I need a very simple class that can be reused anywhere and ...
0
votes
0answers
27 views

Using arrays in str_replace [migrated]

Is this valid PHP syntax? I think it may be causing the following warning: Warning: Illegal offset type $filterclear = str_replace($tag, '', $queryString); $filterclear = str_replace(array('=+', ...
0
votes
1answer
28 views

PHP illegal offset type in multiple loop structure

For reference, the function in question takes a URL structure which is most often a query string (but sometimes not) and generates filters to remove query var's from the URL. So if you're looking at ...
4
votes
1answer
78 views

Is this violating the DRY principle?

I feel that I am repeating myself a lot with this HTML/PHP code. Am I right, and is there a maintainable way of reducing the amount of repetition in the code? mydomain/index.php: <!DOCTYPE ...
1
vote
1answer
57 views

Simple Factory Pattern Demo

I am trying to create a simple factory pattern demo in PHP. I am not sure if my codes are the best practice. It seems that I have some duplicated codes but I am not sure how to improve it. Basically, ...

1 2 3 4 5 29
15 30 50 per page