Re: [PHP] Re: Object-oriented $_REQUEST?

2007-04-30 Thread Philip Thompson

On Apr 28, 2007, at 5:13 PM, Robert Cummings wrote:


On Sat, 2007-04-28 at 23:41 +0200, keviN wrote:

?php

class get


I'm sorry but your code indicates an extreme lack of experience using
PHP in the real world. Your class should be named such that it will
never collide with someone else's class name in the event you might  
need

to use third party libraries. A better name for your class follows:

?php

class get_Z398N24N894287YN043872348N734D83Y78N7D7834
{
}

$get = new get_Z398N24N894287YN043872348N734D83Y78N7D7834();

?


LOL!!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Object-oriented $_REQUEST?

2007-04-28 Thread keviN
?php

class get

{

private $array;

function __construct($array)

{

$this-array = $array;

}

public function get($key)

{

if (isset($this-array[$key]))

return $this-array[$key];

return null;

}

}

class request

{

private $types = array('COOKIE', 'REQUEST', 'GET', 'POST', 'SESSION');

function __construct()

{

foreach ($this-types as $type)

{

//do not link the result of eval into a variable because it is passed to 
__construct as reference

$this-$type = new get(eval('return $_' . $type . ';'));

}

}

}

$request = new request();

var_dump($request-REQUEST-get('name'));

?



js  [EMAIL PROTECTED] schrieb im Newsbeitrag 
news:[EMAIL PROTECTED]
 Hi.

 I'm looking for implementation of request object
 that represent a request that works like this.

 $r = new request();
 if ($r-method == 'GET')
$name = $r-GET-get('name');
$age = $r-GET-get('age');
 else if (request.method == 'POST')
$name = $r-POST-get('name');
$age = $r-POST-get('age');
 ...

 Handling $_GET, $_POST directly is cumbersome for me
 so I tried to make one but I thought it's quite possible that
 some better programmer already make one like this.

 Thanks in advance. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Object-oriented $_REQUEST?

2007-04-28 Thread Robert Cummings
On Sat, 2007-04-28 at 23:41 +0200, keviN wrote:
 ?php
 
 class get

I'm sorry but your code indicates an extreme lack of experience using
PHP in the real world. Your class should be named such that it will
never collide with someone else's class name in the event you might need
to use third party libraries. A better name for your class follows:

?php

class get_Z398N24N894287YN043872348N734D83Y78N7D7834
{
}

$get = new get_Z398N24N894287YN043872348N734D83Y78N7D7834();

?

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php