[PHP] How to store data that doesn't change?

2010-09-15 Thread Peter van der Does
in a registry class 3. Store it in a named constant. 4. Use a function that will return the data (kind of like a regsitry class but it's not a class) Personally I don't like option 1 but what about the other options. Is any of them faster then the others. What other pros and cons are there.

Re: [PHP] Math Question....

2010-04-22 Thread Peter van der Does
On Thu, 22 Apr 2010 10:49:11 -0400 Peter van der Does wrote: > > My take on it: > > $Items=1252398; > $MaxInGroup=30; > for ($x=$MaxInGroup; $x>1;$x--) { > $remainder=$Items % $x; > // Change 17 to the max amount allowed in the last group > if

Re: [PHP] Math Question....

2010-04-22 Thread Peter van der Does
ot;\n"; echo $remainder; break; } } -- Peter van der Does GPG key: E77E8E98 IRC: Ganseki on irc.freenode.net Twitter: @petervanderdoes WordPress Plugin Developer Blog: http://blog.avirtualhome.com Forums: http://forums.avirtualhome.com Twitter: @avhsoftware -- PHP Gen

Re: [PHP] Global Var Disappearing After Function

2010-03-22 Thread Peter van der Does
ction is called. > > What is causing this? And how can I fix it? > > Thanks! > From PHP.net: If a globalized variable is unset() inside of a function, only the local variable is destroyed. The variable in the calling environment will retain the same value as before unset() was ca

[PHP] Using ArrayObject

2010-03-09 Thread Peter van der Does
What is the advantage of using ArrayObject to build a Registry class? -- Peter van der Does GPG key: E77E8E98 IRC: Ganseki on irc.freenode.net Twitter: @petervanderdoes WordPress Plugin Developer Blog: http://blog.avirtualhome.com Forums: http://forums.avirtualhome.com Twitter: @avhsoftware

[PHP] Registry class question.

2010-02-26 Thread Peter van der Does
tSetting($key) { return $this->_settings[$key]; } The question is what the pros and cons are compared to setting a new property with the value, like: storeSetting($key,$value) { $this->$key = $value; } and then instead of calling getSetting, you just use $this->Registry->propert

Re: [PHP] Spam opinions please

2009-10-20 Thread Peter van der Does
m and adds spam IP in the .htaccess file. I have it set up in cron to run daily. For a little bit more detailed description and the program itself: http://blog.avirtualhome.com/2009/10/08/stop-spammers-in-your-htaccess/ -- Peter van der Does GPG key: E77E8E98 IRC: Ganseki on irc.freenode.net

Re: [PHP] Form Spam

2009-08-20 Thread Peter van der Does
could implement a nonce on your form and check it during the processing of the post. A second idea is to check the IP of the visitor during the POST process, with something like stopforumspam or project honey pot. If you want more info let me know. -- Peter van der Does GPG key: E77

Re: [PHP] Anyone know whats the best way to learn PHP

2009-06-01 Thread Peter van der Does
omputer or natural, is not by sitting down and reading books, it's by actually programming/speaking the language. -- Peter van der Does GPG key: E77E8E98 IRC: Ganseki on irc.freenode.net Blog: http://blog.avirtualhome.com Forums: http://forums.avirtualhome.com Jabber ID: pvanderd...@gmail.com GetD

Re: [PHP] Re: PHP class question

2009-05-21 Thread Peter van der Does
Class A needs to be an extension of the framework class. -- Peter van der Does GPG key: E77E8E98 IRC: Ganseki on irc.freenode.net Blog: http://blog.avirtualhome.com Forums: http://forums.avirtualhome.com Jabber ID: pvanderd...@gmail.com GetDeb Package Builder http://www.getdeb.net - Softw

[PHP] PHP class question

2009-05-21 Thread Peter van der Does
s A extends framework_class { $var core; // PHP4 constructor function A { $this->core = new core(); $this->core->go(); } } The question I have, is this a good solution, is it the only solution or are there different ways to tackle this? As you might see it needs to run in PHP4. --

[PHP] Multiple return statements in a function.

2009-04-23 Thread Peter van der Does
e { $return='Not Array'; } return $return; } Example of the other method: function check($a) { if ( is_array( $a ) ) { return ('Array'); } else { return ('Not Array'); } } What is your take? And is there any benefit to either method? --

Re: [PHP] What is wrong with this code

2009-04-03 Thread Peter van der Does
e. Please don't fill in the address field. Address Name: Email Address: Comments: '; echo 'You have supplied the following information:'; echo 'Name: $name '; echo 'Email Address: $email '; echo &

Re: [PHP] ltrim behavior.

2009-03-11 Thread Peter van der Does
On Wed, 11 Mar 2009 15:28:04 -0400 Paul M Foster wrote: > On Wed, Mar 11, 2009 at 03:07:18PM -0400, Peter van der Does wrote: > > > This might be old for some of you but I never encountered it until > > today and I would like to know why this is happening. > > > >

[PHP] ltrim behavior.

2009-03-11 Thread Peter van der Does
x27;options[options][name]'; php > echo ltrim($a,'options['); ][name] UH, what? Not exactly what I expected. This works: php > $a='options[options][name]'; php > echo ltrim(ltrim($a,'options'),'['); options][name] Can somebody explain the sec