Re: [PHP-DEV] Garbage Collection!

2002-05-17 Thread Robert Cummings

Zeev Suraski wrote:
> 
> If you're adding elements to a hash you created using array_init(), and
> you're using the standard macros (which apparently you are) - then yes, the
> engine will take care of garbage collection for you.

Thanks a lot, this is what I needed to know, I guess somehow I have
allocation going on somewhere else.

Cheers,
Rob.
-- 
.-----.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Garbage Collection!

2002-05-17 Thread Robert Cummings

Zeev Suraski wrote:
> 
> At 09:04 PM 5/17/2002, Robert Cummings wrote:
> >To be honest I'm passing the return_value into my recursion
> 
> Not sure what you mean by that - return_value is handled by the engine as
> soon as you return from your function implementation, if that's what you're
> asking.  If you're using it internally, then you're responsible for it
> until you return from your code.

Well I'm creating a nested hash that I want to return ultimately, so
at my first recursive step I pass return_value as the hash to be filled.
However at various steps in the recursion I add elements to the hash that
overwrite default values. So my question is whether during this recursive
process does the garbage collector run when I overwrite a hash entry?
Hope that clears things up.

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Garbage Collection!

2002-05-17 Thread Robert Cummings

Zeev Suraski wrote:
> 
> At 08:53 PM 5/17/2002, Robert Cummings wrote:
> >Let's say I do:
> >
> > zval *newVar;
> > MAKE_STD_ZVAL( newVar );
> > ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );
> >
> >and then I do:
> >
> > MAKE_STD_ZVAL( newVar );
> > ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );
> >
> >This will overwrite my orignal newVar, however, will the original
> >newVar be garbaged collected or is this my responsibility now that
> >I'm out of PHP land? Also if it is auto garbage collected, is there
> >a way I can force garbage collection to run while I'm in a deep
> >recursion?
> 
> Whatever you register into the standard data structures, EG(symbol_table)
> included, is taken care of by the engine.  In that case, the old value will
> be destroyed as soon as you replace it in the 2nd SET_SYMBOL call.

To be honest I'm passing the return_value into my recursion
- is the same true of it? I ask because I watched my memory
consumption climb to over 500MB and all I use is
MAKE_STD_ZVAL( newVar ) and insert into some depth of the
recursion initially stored into return_value for the
calling function. My initial assumption was that indeed this
stuff is garbage collected... but maybe I'm doing something
wrong if this is collected at the moment of overwrite and
I'm seeing such massive allocations using top.

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Garbage Collection!

2002-05-17 Thread Robert Cummings

Let's say I do:

zval *newVar;
MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );

and then I do:

MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );

This will overwrite my orignal newVar, however, will the original
newVar be garbaged collected or is this my responsibility now that
I'm out of PHP land? Also if it is auto garbage collected, is there
a way I can force garbage collection to run while I'm in a deep
recursion?

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Help please.

2002-05-16 Thread Robert Cummings

Is there someplace other than:

http://www.php.net/manual/en/zend.php

Where I can get more advanced information about how the engine
itself works. While I've made some extensions I was recently
wondering if perhaps I've done some things wrong (no doubt I have).
For instance... Let's say I do:

zval *newVar;
MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );

and then for some unknown reason not particularly important
for this discussion I do the following:

MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );

This will overwrite my orignal newVar, however, will the original
newVar be garbaged collected or is this my responsibility now that
I'm out of PHP land? Also if it is auto garbage collected, is there
a way I can force garbage collection to run while I'm in a deep
recursion?

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Information request.

2002-05-15 Thread Robert Cummings

I apologize for double posting this, until today I didn't
realize replying-to and clearing the subject line caused me
to thread into the previous message, in other words I didn't
know that a reference was sent via the headers.
--

Is there someplace other than:

http://www.php.net/manual/en/zend.php

Where I can get more advanced information about how the engine
itself work. While I've made some extensions I was recently
wondering if perhaps I've done some things wrong (no doubt I have).
For instance... Let's say I do:

zval *newVar;
MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );

and then for some unknown reason not particularly important
for this discussion I do the following:

MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );

This will overwrite my orignal newVar, however, will the original
newVar be garbaged collected or is this my responsibility now that
I'm out of PHP land? Also if it is auto garbage collected, is there
a way I can force garbage collection to run while I'm in a deep
recursion?

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Information request.

2002-05-15 Thread Robert Cummings

Is there someplace other than:

http://www.php.net/manual/en/zend.php

Where I can get more advanced information about how the engine
itself work. While I've made some extensions I was recently
wondering if perhaps I've done some things wrong (no doubt I have).
For instance... Let's say I do:

zval *newVar;
MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );

and then for some unknown reason not particularly important
for this discussion I do the following:

MAKE_STD_ZVAL( newVar );
ZEND_SET_SYMBOL( &EG(symbol_table), "varKey", newVar );

This will overwrite my orignal newVar, however, will the original
newVar be garbaged collected or is this my responsibility now that
I'm out of PHP land? Also if it is auto garbage collected, is there
a way I can force garbage collection to run while I'm in a deep
recursion?

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Probably a simple answer...

2002-05-14 Thread Robert Cummings

Simon Fogg wrote:
> 
> That's o.k.- I'm just grouchy. There seems to be so much information to wade
> through to find out what you need to know.
> 
> Since we are on the subject though, and you have already done this sort of
> thing before, can you tell me whether extensions are supported on MacOSX. My
> Mac colleague is off sick today and since I am looking at finding a fairly
> X-Plaform solution to our problem, I thought it would be beneficial if I
> could find out whether the same solution could be used on a Mac.

I don't see why not provided you are able to compile PHP. As long as you
can compile PHP your extension "should" compile into a Mac native binary.
All you should need to do is create wrapper functions around your current
library to make them accessible via PHP in your extension. If you're like me
you will compile this directly into the PHP binary itself, and then I don't
think you will need any other binaries. Alternatively, since you are
comparing this to window's DLLs I think you can compile as a shared library,
but I don't know much about that route and wouldn't advise it since as
far as I know it runs like CGI.

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Probably a simple answer...

2002-05-14 Thread Robert Cummings

Simon Fogg wrote:
> 
> I believe you hijacked my thread - The original subject was: 'Creating
> extension module for PHP'!

I was asking about specific information about specific functionality,
your thread asks about how to write an extension... I already know how
and have done so, I'd just like to know more about what I'm doing and
since there isn't much in the way of docs for doing so, then sometimes
I need to clear things up here. I apologize if it appears I hijacked
your thread..

Cheers,
Rob.
-- 
.-----.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Probably a simple answer...

2002-05-14 Thread Robert Cummings

Robert Cummings wrote:
> 
> brad lafountain wrote:
> >
> > Well i do believe that the zval string SHOULD be null termiated and have the
> > length stored.
> 
> You would think so, but on further thought, if that were the case you
> wouldn't be able to store compressed data from gzip in a string because
> the null bytes everywhere would interfere. Also, as I said, ZVAL_STRING
> suggests that this is so... since when you use it to set a zval container
> to a string it saves the length as strlen( passedString ), rather
> than strlen( passedString ) + 1, also the memcpy then uses this length
^^
I just took another look at ZVAL_STRING and it uses estrndup and
not memcpy... maybe I'm losing my mind :)

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Probably a simple answer...

2002-05-14 Thread Robert Cummings

brad lafountain wrote:
> 
> Well i do believe that the zval string SHOULD be null termiated and have the
> length stored.
> 
>  But zend does provied this api function
> 
> zend_binary_zval_strcmp(zval *, zval*);

Oh and I almost forgot... THANKS... this appears to be exactly
what I was looking for :)

Cheers,
Rob.
-- 
.-----.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] Probably a simple answer...

2002-05-14 Thread Robert Cummings

brad lafountain wrote:
> 
> Well i do believe that the zval string SHOULD be null termiated and have the
> length stored.

You would think so, but on further thought, if that were the case you
wouldn't be able to store compressed data from gzip in a string because
the null bytes everywhere would interfere. Also, as I said, ZVAL_STRING
suggests that this is so... since when you use it to set a zval container
to a string it saves the length as strlen( passedString ), rather
than strlen( passedString ) + 1, also the memcpy then uses this length
to copy the string if you set the copy flag to true.

Cheers,
Rob.


> 
>  But zend does provied this api function
> 
> zend_binary_zval_strcmp(zval *, zval*);
> 
>  - Brad
> 
> --- Robert Cummings <[EMAIL PROTECTED]> wrote:
> > zval containers that are of string type don't seem to hold
> > a null terminating character, but rather directly store the
> > length of the string - I note this because of how the
> > ZVAL_STRING macro works... My question then is what is the
> > best way to compare two strings in a zval? I would imagine
> > a macro or function would already exist, and I'm quite sure
> > that the following simple invocation is asking for trouble:
> >
> > strcmp( Z_STRVAL_P( target1 ), Z_STRVAL_P( target2 ) ) == 0
> >
> > Thanks for any information.
> >
> > Cheers,
> > Rob.
> > --
> > .-.
> > | Robert Cummings |
> > :-`.
> > | Webdeployer - Chief PHP and Java Programmer  |
> > :--:
> > | Mail  : mailto:[EMAIL PROTECTED] |
> > | Phone : (613) 731-4046 x.109 |
> > :--:
> > | Website : http://www.webmotion.com   |
> > | Fax : (613) 260-9545 |
> > `--'
> >
> > --
> > PHP Development Mailing List <http://www.php.net/>
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> __
> Do You Yahoo!?
> LAUNCH - Your Yahoo! Music Experience
> http://launch.yahoo.com

-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Probably a simple answer...

2002-05-14 Thread Robert Cummings

zval containers that are of string type don't seem to hold
a null terminating character, but rather directly store the
length of the string - I note this because of how the
ZVAL_STRING macro works... My question then is what is the
best way to compare two strings in a zval? I would imagine
a macro or function would already exist, and I'm quite sure
that the following simple invocation is asking for trouble:

strcmp( Z_STRVAL_P( target1 ), Z_STRVAL_P( target2 ) ) == 0

Thanks for any information.

Cheers,
Rob.
-- 
.-----.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] feature request for __LINE__, __FILE__ and trigger_error

2002-04-26 Thread Robert Cummings


I wrote this extension a while back, but I never released it since
I didn't follow coding style and it was my first forage into extension
coding for PHP. It should be what your looking for though for the
most part... the function of usefulness is: get_function_call_stack()
which will return an array with the call stack for the current function
which includes the calling file, funcion and line number. Use a print_r()
on the results to get a better idea. Please don't flame me for not
releasing or following coding style.

Cheers,
Rob.
-

[EMAIL PROTECTED] wrote:
> 
> Addressed to: [EMAIL PROTECTED]
>   [EMAIL PROTECTED]
> 
> ** Reply to note from [EMAIL PROTECTED] Wed, 24 Apr 2002 21:06:41 +0200 (CEST)
> >
> > Hello Michael,
> >
> > I'm working (80% done) on an extension for this. It should be finished in
> >  a few days. It doesn't feature the __C*__ things yet, but I can add a
> > function for that too.
> >
> > I'll keep you posted,
> 
> 
> 
> Thanks, I've wished for this for a long time!

-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'


ftrace.tar.gz
Description: GNU Zip compressed data

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DEV] The PHP Platform

2002-04-16 Thread Robert Cummings

I keep hearing a lot of "my company this in microsoft" and "my company that"
and "blah blah blah". I'm sorry, but if the fullfillment of all your dreams
are in your company then you live a sad, sad life. The future is what you make
of it, and each and every person has the power to contribute to change what
may be.

Cheers,
Rob.


Dave Mertens wrote:
> 
> On Tue, Apr 16, 2002 at 07:57:26AM -0700, brad lafountain wrote:
> > > --- Dave Mertens <[EMAIL PROTECTED]> wrote:
> > > But the fact the PHP don't have a proper XML parser, only a scripting SOAP
> > > parser
> >
> >  Well i currently am working on a soap c extension for php (ext/soap). Its
> > pretty fast. And with other technologies like ext/session and ext/msession I
> > have created a way to create a cluster of soap object with each soap request
> > not needing to got the same machine. My extension is in a 'alpha' stage right
> > now. I am working on a website and docuementation right now. After that im
> > going to clean up the code and release an alpha release. I'll definly email
> > this list when i get something i want to release.
> 
> I didn't know there was an native SOAP parses in PHP. I hope it will become 
>production soon, so i can start using it.
> 
> But than on the other hand XML is still very poor in PHP. And the relation between 
>SOAP and XML is very tight.
> 
> But i'm not trying to trap someone into the floor, i'm only saying what i'm facing 
>as a PHP developer in a company that is a Microsoft partner.
> See it as a coca-cola agent who likes Pepsi. It's hard to sell Coca-cola when you 
>like Pepsi.
> 
> But i'm a Pepsi agent that is trying to sell Pepsi to the Coca-cola factory!
> 
> Dave Mertens
> 
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php

-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] The PHP Platform

2002-04-15 Thread Robert Cummings

Hey all,

I'm just doing a general followup to say how much I love the PHP
engine. I find it extremely fast for development and I love that
I can integrate C extension modules when time is a huge factor.
While PHP seems to be moving into the shadows here where I work
I find that I love it more and more personally and is my favourite
engine for doing just about everything. I use it for the web and
for shell scripting. Most of all I love that something like this
can be free, since in my spare time I like to code for a MUD,
which doesn't make me any money, but which I find very satisfying.
Kudos to all the PHP contributors.

Cheers,
Rob.
-- 
.-----.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] object refrences (POSSIBLE MAJOR BUG)

2002-04-11 Thread Robert Cummings

My apologies... this examples better clarifies your point and I must admit
that it is rather strange behaviour :) And I think I forgot that PHP does
do deep copies, probably because I'm so used to writing wrapper objects
with references to my real objects so I automate shallow copies.

Cheers,
Rob.

brad lafountain wrote:
> 
> 
>  I do understand the difference... but it also doesn't say it does a shallow
> copy. because it DOES do a deep copy run the following code..
> 
>  class foo
> {
>  function foo()
>  {
>   $this->bar = new bar();
>  }
> }
> 
> class bar
> {
>  function bar()
>  {
>   $this->tmp = "bar";
>  }
>  function do_nothing()
>  {
>  }
> }
> 
> // As you see no shallow copy!!
> $foo = new foo();
> $foo->bar->tmp = "test";
> $foo2 = $foo;
> $foo2->bar->tmp = "foo";
> var_dump($foo);
> var_dump($foo2);
> 
> // now
> $foo->bar->do_nothing();
> $foo3 = $foo;
> $foo3->bar->tmp = "bug";
> var_dump($foo);
> var_dump($foo3);
> ?>
> 
> as soon as a function is called from a objects member.. this is where the
> refrence is created!
> 
>  - Brad

-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] object refrences (POSSIBLE MAJOR BUG)

2002-04-11 Thread Robert Cummings

Andrey Hristov wrote:
> 
> But dereferncing like this
> $foo->bar()->fubar
> is feature of Z2 or not?
> Till today I didn't know that my 4.1.1(or 2) not sure can do this kind of 
>dereferencing.

The above quote dereference involves an intermediate method, the one
described in the example below uses an object which is currently
supported.

> > $foo = new foo();
> > $foo->bar->set_tmp("outside foo");
> > $foo->variable = "foo";

As far as references go... I believe when you copy an object it is a
shallow copy, in otherwords, the object is copied, but not its members.
This behaviour is preferrable as far as I'm concerned. If you want a
deep copy try doing the following:

$foo = new foo();
$fee = unserialize( serialize( $foo ) );

That should provide a nice quick, clean solution for what you want while
not incurring the overhead most programmers would rather skip on every
object copy.

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Finding key in a hash...

2002-04-11 Thread Robert Cummings


I am trying to determine if a key exists in a hash that has been passed
to my function. I couldn't find much information on finding how to do
it, but from greping the source I managed to come up with the following.
Problem is it doesn't work *heh*. All I want to do is check whether the
key exists or not and act appropriately. My code compiles fine, but the
zend_hash_exists() test always returns false. The A facsimile of my code
follows:
---
ZEND_FUNCTION( foofunction ){

zval **paramHash = NULL;
zval  *aHash = NULL;

if( ZEND_NUM_ARGS() != 1 ||zend_get_parameters_ex( ZEND_NUM_ARGS(), ¶mHash ) 
== FAILURE ){
WRONG_PARAM_COUNT;
} 

aHash = *paramHash;

if( zend_hash_exists( aHash->value.ht, "foo", sizeof( "foo" ) ) ){
//
// Do something here.
//
}
else{
//
// Do something else here.
//
}
}

---
In my PHP code I have the following:
---

$aHash = array();
$aHash['foo'] = 'fee';

foofunction( $aHash );

-------

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Re-entrant PHP

2002-04-05 Thread Robert Cummings


I mostly don't keep up with the bulk of the PHP threads; however, I
did a pretty thorough scan of them to find information about re-entrancy
and didn't find anything to answer my question. So here goes... I was
wondering if there were any plans to make php_mod re-entrant in any
way or if there were any comments on how difficult this task would be.
I see the advantages of re-entrancy being that my source code wouldn't
need to be reloaded every single time a page is loaded; much of the data
would already be in memory with respect to properties and caching; I
could have a global persistent cache for some of my data versus saving
to a database or shared memory location for subsequent page hit retrieval.
Mostly I just don't want my source code re-parsed and loaded on every
hit since that is a large overhead once you get into several layers of
abstraction.

Cheers,
Rob.
-- 
.-----.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php