Container Functions Continued.....

This is a discussion on Container Functions Continued..... within the PHP General forums, part of the PHP Programming Forums category; Thanks to everyone who responded to me so far, but I fear that I have not explained myself too clearly. ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 08-11-2003
Mike Morton
 
Posts: n/a
Default Container Functions Continued.....

Thanks to everyone who responded to me so far, but I fear that I have not
explained myself too clearly.

First of all, I understand the argument about having a testing, development
and live servers, however, in the real world not every client can afford
that hardware and it is not always feasable for smaller websites to have all
the equipment.

So, lets base this on the fact that there is one server that has one URL,
One IP and all development/testing is done on the live website.

Now that I have that out of the way.

What I am trying to accomplish is a function that can contain code blocks,
like an if statement. Something that would operate like:

developer_execute() {
execute this code only
}

Where the function developer_execute would be defined as:
function developer_execute() {
if(getenv("REMOTE_ADDR")=="000.000.000.000") {
%body
}
}

Where the %body is the actual code represented by 'execute this code only'
above.

So, the question is, is there a way to create a function like an if function
that does not only reply on the arguments between the ( and ) in the
function call?

Thanks again.



--
Cheers

Mike Morton

************************************************** **
*
* Tel: 905-465-1263
* Email: mike@webtraxx.com
*
************************************************** **

"Indeed, it would not be an exaggeration to describe the history of the
computer industry for the past decade as a massive effort to keep up with
Apple."
- Byte Magazine

Given infinite time, 100 monkeys could type out the complete works of
Shakespeare. Win 98 source code? Eight monkeys, five minutes.
-- NullGrey

Reply With Quote
  #2 (permalink)  
Old 08-11-2003
David Otton
 
Posts: n/a
Default Re: [PHP] Container Functions Continued.....

On Sun, 10 Aug 2003 18:04:00 -0400, you wrote:

>First of all, I understand the argument about having a testing, development
>and live servers, however, in the real world not every client can afford
>that hardware and it is not always feasable for smaller websites to have all
>the equipment.


The dev machine is the one you do your work on. The staging and live
machines can be the same physical hardware. Either VirtualHosts or

http://www.domain.com/
http://www.domain.com/newversion/

>What I am trying to accomplish is a function that can contain code blocks,
>like an if statement. Something that would operate like:
>
>developer_execute() {
> execute this code only
>}
>
>Where the function developer_execute would be defined as:
>function developer_execute() {
> if(getenv("REMOTE_ADDR")=="000.000.000.000") {
> %body
> }
>}


If eval()'s no good to you, then this problem is something like #defining
in/out blocks of debug code in C.

if (getenv ('REMOTE_ADDR') == '000.000.000.000') {
define ('TESTING', 1);
} else {
define ('TESTING', 0);
}

if (TESTING) {
echo (5+3);
}

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 02:35 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0