0
votes
1answer
54 views

How to make proper code out of this function

public function getStuff($brand) { $web=FALSE; if($this->getWebcorners()): foreach ($this->getWebcorners() as $webcorner): ...
3
votes
2answers
115 views

How can this this URL Checker be made cleaner?

I have a table full of URLs, some of which will occasionally become invalid. As part of a system I'm writing to go through the links periodically, and test if they are valid (or redirect to valid ...
5
votes
2answers
99 views

Array find min value with user-defined comparison compare function

My user defined comparison compare function is defined with an array: $boardkey_to_values=Array(19=>2601248,23=>2601248,39=>2603445, ...
0
votes
2answers
140 views

A better way of writing a PHP function

As the title says, I'm looking for a better way of writing the following PHP function as it's a very very long one. It's part of a bigger class and I'm trying to keep the amount of code as little as ...
1
vote
1answer
66 views

A puzzle about how to write more clean and understandability code

private function getFeatureByParam ($classname, $module, $action) { $needFeature = array(); foreach ($this->featureConf as $featureIndex => $feature) { if ($feature['classname'] ...
2
votes
1answer
196 views

The perfect PHP login script

I posted this same question on StackOverflow but guys over there told me to post it here. I have programming in PHP since past 2 years and yet haven't found a perfect script for logging the user in. ...
8
votes
4answers
200 views

Please review simple VisitorCounter class

This is my first post! I am trying to learn the absolute best way to program/design classes in PHP. I am hoping that you would be able to review and critique this simple class. Note: I know that ...
0
votes
0answers
25 views

optimized way of checking and assigning a function boolean [duplicate]

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 ...
9
votes
4answers
1k views

Looking at this code, would you say I'm an OK coder?

Looking at this code, would you say I'm an OK coder? I just created this during a live screencast. The people who were on there were very very very critical of almost every line of code. They say I ...
2
votes
2answers
166 views

Two similar API calls PHP optimisation and structure

I have the following script that I'm part way through and I'm not happy with it at all, it feels messy: <?php class Process { public $search = ...
1
vote
3answers
352 views

PHP if, else, and return true/false

Just wondering if my else {return false;} statements are superfluous... do I just need one return true; here? function has_access() { if ( is_user_logged_in() ) { $role = ...
1
vote
2answers
721 views

Mutlilevel page list in CodeIgniter

I'm newly working with CodeIgniter and PHP. I wrote a category structured 'pages' code with listing pages as multilevel list or indented select box. page ...
2
votes
1answer
235 views

using oop in php

This is one of my first oop code in normal php without any framework. This a code that combines all css files into one and all js files into one and it works. Any suggestion on what can i make better ...
1
vote
1answer
106 views

PHP Code Improvements

I would like to improve the following code that I posted below. It does the job perfectly, but I just feel like it could definitely be improved. I could easily leave it the way it is but I am trying ...
2
votes
2answers
72 views

How can i refactor this PHP read text file better. I am reading from 3 text files using fopen, want to refactor it

I have the following code, it gets the data from 3 text files and puts them into 3 variables. How can I refactor this to make it smaller? Any Ideas? $handle = fopen($template_filename, "r"); if ...

1 2
15 30 50 per page