Current Contest
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP ContestsCurrent Contest

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old September 25th, 2004, 08:08 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
Functions outside own classes

In the restrictions there is a line with this rule:
Quote:
Your script should NOT contain ANY CODE outside of your classes, and your code should NOT access ANYTHING outside of your own classes.


What is, if I want to use some array functions like array_filter() or array_walk() which need a function pointer as parameter ? for example:
php Code:
Original - php Code
  1.  
  2. <?
  3. function odd($var) {
  4.    return($var % 2 == 1);
  5. }
  6.  
  7. class blabla() {
  8.    blabla() {
  9.       print_r(array_filter(array(1,2,3,4,5,6), "odd"));
  10.    }
  11. }
  12. ?>


Is this allowed ? I didn't find any way to use a member function of a class in the array_filter().

Reply With Quote
  #2  
Old September 25th, 2004, 08:18 PM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Functions outside own classes

this should work:

array_filter(array(1,2,3), array(myObj, 'methodName'));

Reply With Quote
  #3  
Old October 20th, 2004, 11:41 AM
ShiVAs ShiVAs is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Vilnius, Lithuania
Posts: 15 ShiVAs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to ShiVAs Send a message via AIM to ShiVAs
RE: Functions outside own classes

I hope i can define some constants outside my class? Like:

php Code:
Original - php Code
  1.  
  2. define ('SHIVAS_ROOMSOFFSET',4);

Reply With Quote
  #4  
Old October 21st, 2004, 03:13 AM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Functions outside own classes

umh, didn't think of that..

it will be ok for this contest, but i will have to think about it for the next one.. (prefixing probably)

Reply With Quote
  #5  
Old October 21st, 2004, 11:03 AM
ShiVAs ShiVAs is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Vilnius, Lithuania
Posts: 15 ShiVAs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to ShiVAs Send a message via AIM to ShiVAs
RE: Functions outside own classes

I think, u MUST add this to contest rules now, becoz u know what will happen if someone defines my constant before me. There will be warning, and after all, my script will suck

Reply With Quote
  #6  
Old October 22nd, 2004, 01:08 AM
zombie zombie is offline
Codewalkers Intermediate (1500 - 1999 posts)
 
Join Date: Apr 2007
Location: serbia
Posts: 1,876 zombie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 3
RE: Functions outside own classes

i think i CANT add any rules just two days before the closing day of the contest, don't you agree?

btw, for this contest, your scripts will be loaded only one-at-a-time, so there is no way for that to happen.

in the next contest, there will be a rule about that..

Reply With Quote
  #7  
Old October 22nd, 2004, 06:58 AM
ShiVAs ShiVAs is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Vilnius, Lithuania
Posts: 15 ShiVAs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to ShiVAs Send a message via AIM to ShiVAs
RE: Functions outside own classes

If only one at the time - there is no problem.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP ContestsCurrent Contest > Functions outside own classes


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT