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, 09: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: 25
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, 09: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: 4
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, 12:41 PM
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, 04: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: 4
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, 12:03 PM
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, 02: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: 4
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, 07: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
  #8  
Old October 15th, 2009, 01:01 PM
Hydrolyze Hydrolyze is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Location: Slovakia
Posts: 1 Hydrolyze User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 sec
Reputation Power: 0
Send a message via ICQ to Hydrolyze
1st time posting here

Just wanted to say hello all. This is my first post.I hope to learn alot here.

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




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

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




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek