Re: [PHP] nuSoap client SOAP Call problem

2007-08-25 Thread Angelo Zanetti



Thijs Lensselink wrote:

On Fri, 24 Aug 2007 13:55:29 +0200, Angelo Zanetti <[EMAIL PROTECTED]> wrote:
  

Thijs Lensselink wrote:


On Fri, 24 Aug 2007 12:39:06 +0200, Angelo Zanetti <[EMAIL PROTECTED]>
  

wrote:


Thijs Lensselink wrote:



On Fri, 24 Aug 2007 11:53:12 +0200, Angelo Zanetti
  

<[EMAIL PROTECTED]>


wrote:



It's probably better to ask on a NuSOAP list.

The call method needs an array with parameters as far as i remember.
But i never use the call method anyway. I always go for the send

  

method.



First create your request XML.

$request = '
xx
yy
Angelo1
';

Then serialize the envelope so it looks like a SOAP request.

$msg = $client->serializeEnvelope($request, false, false,
  

'document',

  

'literal');




And use the send method to make a connection and send the request.

$action = 'location of the webservice';



  

The action variable is that the URL of the WSDL?





$results = $client->send($msg, $action, 60, 60);



  

Why do you have 60 twice? As far as I can see in the API the send
document is only receiving 3 parameters?

I have posted to many SOAP forums and the mailing list. No luck what


so


ever. Your the first to reply thanks, I think this could work.

Your help is very much appreciated.

regards
Angelo




Hey Angelo,

I know getting info for NuSOAP is a b*tch. Maybe switch to PHP5 and
  

the


SOAP extension?



The $action variable is not the WSDL url. I missed that part in your

  

first post.



The $action var is actually build up from two parts. The first part

  

being the webservice



location. And the second part is /webserviceAction

The reason i have two 60's in the method call is because in the

  

soapclient



class the method looks like this:

function send($msg, $soapaction = '', $timeout=0,
  

$response_timeout=30)


{



But in the meantime i've been trying some other things with NuSOAP.
  

And


got this to work with WSDL.



$request = '
xx
yy
Angelo1
 ';

$params = array('request' => $request);

$operation = 'WebserviceAction';
$result = $client->call($operation, $params, $namespace);

Hope this helps.



  

Hi, yes I have done it as you have specified with the call method
unfortunately for some weird reason that creates the duplication.
However I have almost got your previous mail working. But in the XML
request I have:
Now I see this is present:  xmlns:0="" --> its an error thats making


the


XML invalid any reason why its making that?


http://schemas.xmlsoap.org/soap/encoding/";
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:si="http://soapinterop.org/xsd"; xmlns:0="">



Another thing i that I have made the action variable to :
"wsdlURL/SubscriptionStatus"  where wsdlURL is the URL of wsdl.
This also doesnt work but it might have to do with the above invalid


XML


so perhaps this is the correct way to create the action parameter?

Thanks again very much.



The empy xmlns means there is no namespace set.
I guess you didn't provide a namespace in the serializeEnvelope method.
The 3rd parameter is set to false in the example. But that's where you
  

should


set the $namspace.

The WSDL url should work if you take of the ?wsdl part.

  

Thanks again.
I have specified the namespace but the problem is that its creating the
weird characters:

xmlns:0=""

:0  Im not sure where they come from and I'm not sure I need the name
space anyway

Any idea why its causing this character?
thank





try this:
$msg = $client->serializeEnvelope($request, '', array(), 'document', 'literal');

  
That worked! I assume that it was send it as an array element therefore 
the 0 appeared causing the XML page to be invalid.


Thanks

--

Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 552 9799
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] 

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



Re: [PHP] nuSoap client SOAP Call problem

2007-08-25 Thread Angelo Zanetti



Thijs Lensselink wrote:

Angelo Zanetti wrote:

  

Thijs Lensselink wrote:


On Fri, 24 Aug 2007 07:57:48 +0200, Angelo Zanetti
<[EMAIL PROTECTED]> wrote:
 
  

Dear all

Im using nusoap to create a cleint and I am having a small issue but
its a
fairly large one because I cant get the correct XML to send.

I have a scenario as follows:

My client:

$wsdlfile="http://xxx_WSDL.xml?wsdl";;
$client=new soapclient($wsdlfile, true); //, true);
$client->soap_defencoding = 'utf-8';

$nameSpace = "xxx";

Tried this:

  $parameters = "";
  $parameters .= "xx";
  $parameters .= "yy";
  $parameters .= "Angelo1";
  $parameters .= "";

$result = $client->call('SubscriptionStatus', $parameters,
$nameSpace);

To call the SubscriptionStatus process.


I have also tried:
/*$Request = array(
array(
 'ISPID' => 'xx',
 'ISPPassword' => 'yy',
 'ISPUserID'=>'Angelo1')
);


$result = $client->call('SubscriptionStatus', $Response,
$nameSpace);


The request must look like this:


http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>

  http://localhost/";>
xx
yy
Angelo1
  




But in fact it looks like this:


http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:si="http://soapinterop.org/xsd";
xmlns:tns="http://devbit.openbit.com/SOS/";>

http://...";>
http://..";>
lighthouse
***
Angelo1





as you can see the

http://...";>

has been repeated. This is causing my problems. I am not sure what is
causing it? Does it have something to do with name spaces? OR the way
the client object is created?


This is a straight forward call but I have been searching through so
many posts and have not had any luck. Please any links or any ideas are
most welcome.

Thanks

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



It's probably better to ask on a NuSOAP list.
The call method needs an array with parameters as far as i remember.
But i never use the call method anyway. I always go for the send method.

First create your request XML.

$request = '
xx
yy
Angelo1
';

Then serialize the envelope so it looks like a SOAP request.

$msg = $client->serializeEnvelope($request, false, false, 'document',
'literal');

And use the send method to make a connection and send the request.

$action = 'location of the webservice';
$results = $client->send($msg, $action, 60, 60);

  
  

Seems to make the XML request correctly but now the response from the
server is the WSDL file? strange even though my request is correct.

Im not 100% sure about the $action parameter? What must be entered
here? Also mustn't I specify the Element that is being consumed in the
webservice IE: "SubscriptionStatus"?

THanks again



The action parameter is something like: http://domain.com/webservice
>From the WSDL file you can get the soapAction. This is where the
requests go.

I think you are sending the XML correctly. But to the wrong endpoint.
(https://netshop.openbit.com/SOS/SOSServlet)



  
Thanks once again. I think its working nicely but I don't get anything 
from my send command but I can see the response and its not the WSDL now 
but the response from the server.


Will have to check that its working 100% but is there any reason why 
there is no result from the send command?


$result = $client->send($msg, $wsdlfile, 60, 60);

thanks again
--

Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 552 9799
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] 

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



Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-25 Thread Nathan Nobbe
i dont know Robert; i think it depends upon the structure of ones business.
for instance; i work for a company full time, and have a start up of my own.
in both of those situations there is no impact on the client in the act of
eliminating php4 from the product implementation.  the clients never use the
code directly.  perhaps you are in some different business??

also, there are many, many enhancements to php5 that php4 does not have.
most notably the oop facilities.  but also, exception handling; re-written
XML
infrastructure (SimpleXML, DOM) and a host of new functions not found in 4.
also, the __autoload feature, and even external tools such as SPL make php5
far superior to php4, imho :)

if its a little slower, i dont really care; ill be using optimization
techniques and
have them mastered w/in the next few months so any innate speed difference
will become negligible in my projects.

i probly shouldnt use the word idiot and php4 in conjunction, to reflect my
feelings
because i might actaullly offend some people on the list :)

-nathan

On 8/25/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
>
> On Sat, 2007-08-25 at 00:28 -0500, Larry Garfield wrote:
> > On Friday 24 August 2007, Lester Caine wrote:
> > > > What would be interesting is if a group picked up PHP4 and kept
> going
> > > > with it in spite of the end of life announcement a few weeks
> back.  I
> > > > wonder if the PHP license would allow such a thing.  How open is it
> > > > exactly?
> > >
> > > The PROBLEM is that supporting PHP4, 5 and now 6 is detracting from
> solving
> > > some of these problems. Until we can get away from HAVING to support
> PHP4,
> > > then PHP5 will not get the full fine tuning it needs. Proposing to
> maintain
> > > a branch of PHP4 will then result n people expecting all of the major
> > > frameworks to work on it - and WE need to be able to concentrate on
> USING
> > > PHP5 properly rather than having to bodge things still to be backwards
> > > compatible with PHP4 :(
> >
> > The "major frameworks" have already agreed that PHP 4 is dead, even
> before the
> > PHP dev team did.
> >
> > http://gophp5.org/
>
> *yawn*
>
> > Anyone expecting anything but a custom in-house application to continue
> to
> > work in PHP 4 by next year is simply not paying attention.  Let it rest
> in
> > peace.
>
> I think many applications will continue to work in PHP4 regardless of
> the gophp5 project. It's not very hard to make applications work in both
> PHP4 and PHP5. I would argue that only an idiot needlessly cuts off more
> than half of their clientele. Elimination of PHP4 updates doesn't mean
> suddenly 100% of the PHP install base becomes PHP5.
>
> Cheers,
> Rob.
> --
> ...
> SwarmBuy.com - http://www.swarmbuy.com
>
> Leveraging the buying power of the masses!
> ...
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-25 Thread Robert Cummings
On Sat, 2007-08-25 at 09:38 -0400, Nathan Nobbe wrote:
> i dont know Robert; i think it depends upon the structure of ones
> business.
> for instance; i work for a company full time, and have a start up of
> my own.
> in both of those situations there is no impact on the client in the
> act of 
> eliminating php4 from the product implementation.  the clients never
> use the
> code directly.  perhaps you are in some different business??

Larry used the words "anything but custom in-house", so you particular
situation is exactly that "your particular situation". There will be
countless non-custom-in-house applications that will continue being
compatible with PHP4 just because it's easy.

> also, there are many, many enhancements to php5 that php4 does not
> have. 
> most notably the oop facilities.  but also, exception handling;
> re-written XML
> infrastructure (SimpleXML, DOM) and a host of new functions not found
> in 4.
> also, the __autoload feature, and even external tools such as SPL make
> php5 
> far superior to php4, imho :)

Says who? Says you and myriad of others that sell sugar and hype. Just
because there's a big fat tasty dolop of icing on the cake doesn't mean
you have to eat it. It's the cake that makes the cake, icing is just
extra.

> if its a little slower, i dont really care; ill be using optimization
> techniques and
> have them mastered w/in the next few months so any innate speed
> difference
> will become negligible in my projects. 

Optimization here isn't the issue. Neither was features. Unless you
abolsutely must use a PHP 5 only feature, why limit yourself to PHP5?
I've yet to find myself absolutely needing a PHP5 feature and yet my
apps work both in PHP4 and PHP5. *shrug* I really don't care what you
do, or what Larry does, I'm just saying that just because the gophp5
group says php5 is the shit, doesn't mean everyone will jump on their
bandwagon and suddenly ignore PHP4.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-25 Thread Nathan Nobbe
yes, i agree, people wont be all-of-a-sudden ignoring php4, but the
notice on php.net says to migrate apps to 5 through the rest of the yaer.
id say thats ample time to move away from it.

pretty much all of my applications rely on php5 features except those
where the system was running on php4 when i arrived.  and then i
have to rely upon contriving mechanisms that are already integrated into 5.
plus i place comments where i could be placing keywords.  the success
of an application using objects in php4 relies heavily on communitcdation
w/in the team, whereas w/ php5 the communication can occur w/in the code
using keywords.

im sure php4 applications can be very robust, but why bother rewriting
things
that are available at the language level as they are in 5; and praying that
someone doesnt call a method because they didnt bother to read the
comments..

-nathan

On 8/25/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
>
> On Sat, 2007-08-25 at 09:38 -0400, Nathan Nobbe wrote:
> > i dont know Robert; i think it depends upon the structure of ones
> > business.
> > for instance; i work for a company full time, and have a start up of
> > my own.
> > in both of those situations there is no impact on the client in the
> > act of
> > eliminating php4 from the product implementation.  the clients never
> > use the
> > code directly.  perhaps you are in some different business??
>
> Larry used the words "anything but custom in-house", so you particular
> situation is exactly that "your particular situation". There will be
> countless non-custom-in-house applications that will continue being
> compatible with PHP4 just because it's easy.
>
> > also, there are many, many enhancements to php5 that php4 does not
> > have.
> > most notably the oop facilities.  but also, exception handling;
> > re-written XML
> > infrastructure (SimpleXML, DOM) and a host of new functions not found
> > in 4.
> > also, the __autoload feature, and even external tools such as SPL make
> > php5
> > far superior to php4, imho :)
>
> Says who? Says you and myriad of others that sell sugar and hype. Just
> because there's a big fat tasty dolop of icing on the cake doesn't mean
> you have to eat it. It's the cake that makes the cake, icing is just
> extra.
>
> > if its a little slower, i dont really care; ill be using optimization
> > techniques and
> > have them mastered w/in the next few months so any innate speed
> > difference
> > will become negligible in my projects.
>
> Optimization here isn't the issue. Neither was features. Unless you
> abolsutely must use a PHP 5 only feature, why limit yourself to PHP5?
> I've yet to find myself absolutely needing a PHP5 feature and yet my
> apps work both in PHP4 and PHP5. *shrug* I really don't care what you
> do, or what Larry does, I'm just saying that just because the gophp5
> group says php5 is the shit, doesn't mean everyone will jump on their
> bandwagon and suddenly ignore PHP4.
>
> Cheers,
> Rob.
> --
> ...
> SwarmBuy.com - http://www.swarmbuy.com
>
> Leveraging the buying power of the masses!
> ...
>


Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-25 Thread Robert Cummings
On Sat, 2007-08-25 at 10:33 -0400, Nathan Nobbe wrote:
> yes, i agree, people wont be all-of-a-sudden ignoring php4, but the
> notice on php.net says to migrate apps to 5 through the rest of the
> yaer. id say thats ample time to move away from it. 

Migrate doesn't necessarily mean ditching PHP4 compatibility. It means
ensuring you are PHP5 compatible. That's reasonable.

> pretty much all of my applications rely on php5 features except those
> where the system was running on php4 when i arrived.  and then i
> have to rely upon contriving mechanisms that are already integrated
> into 5. 
> plus i place comments where i could be placing keywords.  the success
> of an application using objects in php4 relies heavily on
> communitcdation
> w/in the team, whereas w/ php5 the communication can occur w/in the
> code 
> using keywords.
> 
> im sure php4 applications can be very robust, but why bother rewriting
> things
> that are available at the language level as they are in 5; and praying
> that
> someone doesnt call a method because they didnt bother to read the
> comments..

Rewriting? You're assuming developers of PHP4 are using all of the
features in PHP5 but written using PHP4 code. That's not a very valid
assumption. You're also assuming they didn't already have code written
in PHP4 that was then duplicated b internal code in PHP5. Hell, many
PHP4 AND PHP5 developers don't even use OOP. Tell me what is compelling
in PHP5 that doesn't rely on you being an OOP developer? Exceptions
don't count since that's an individual bent. C has no exceptions and it
gets on fine (PHP is written in it :)

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-25 Thread Nathan Nobbe
Robert,

C is a low-level language whereas php is a high level language.
ill admit it openly, i am biased toward oop / design patterns.
and i think what i boils down to is what you view as 'icing'
i view as 'bread-and-butter' ;)

personally i shudder when i see a big pile of usntructured code, or
a bunch of functions that are loosly organized, if at all.  this constitues
most php applications i have seen in the industry of which i have
been participating for roughly 3 yaers now.

look at C++, Java, and PHP.  these languages are all written in C;
they are high level, and although php allows you to write proceedrual
code, i think it is best used from an oop paradigm.

-nathan

On 8/25/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
>
> On Sat, 2007-08-25 at 10:33 -0400, Nathan Nobbe wrote:
> > yes, i agree, people wont be all-of-a-sudden ignoring php4, but the
> > notice on php.net says to migrate apps to 5 through the rest of the
> > yaer. id say thats ample time to move away from it.
>
> Migrate doesn't necessarily mean ditching PHP4 compatibility. It means
> ensuring you are PHP5 compatible. That's reasonable.
>
> > pretty much all of my applications rely on php5 features except those
> > where the system was running on php4 when i arrived.  and then i
> > have to rely upon contriving mechanisms that are already integrated
> > into 5.
> > plus i place comments where i could be placing keywords.  the success
> > of an application using objects in php4 relies heavily on
> > communitcdation
> > w/in the team, whereas w/ php5 the communication can occur w/in the
> > code
> > using keywords.
> >
> > im sure php4 applications can be very robust, but why bother rewriting
> > things
> > that are available at the language level as they are in 5; and praying
> > that
> > someone doesnt call a method because they didnt bother to read the
> > comments..
>
> Rewriting? You're assuming developers of PHP4 are using all of the
> features in PHP5 but written using PHP4 code. That's not a very valid
> assumption. You're also assuming they didn't already have code written
> in PHP4 that was then duplicated b internal code in PHP5. Hell, many
> PHP4 AND PHP5 developers don't even use OOP. Tell me what is compelling
> in PHP5 that doesn't rely on you being an OOP developer? Exceptions
> don't count since that's an individual bent. C has no exceptions and it
> gets on fine (PHP is written in it :)
>
> Cheers,
> Rob.
> --
> ...
> SwarmBuy.com - http://www.swarmbuy.com
>
> Leveraging the buying power of the masses!
> ...
>


Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-25 Thread Robert Cummings
On Sat, 2007-08-25 at 10:57 -0400, Nathan Nobbe wrote:
> Robert,
> 
> C is a low-level language whereas php is a high level language.
> ill admit it openly, i am biased toward oop / design patterns.
> and i think what i boils down to is what you view as 'icing'
> i view as 'bread-and-butter' ;)

I've pulled Larry out of the CC list BTW :)

I also prefer OOP when developing in PHP.

> personally i shudder when i see a big pile of usntructured code, or
> a bunch of functions that are loosly organized, if at all.  this constitues
> most php applications i have seen in the industry of which i have
> been participating for roughly 3 yaers now.

Oh I'd have to agree. Many things I've downloaded and looked at make me
want to gag. But, that's not a symptom of procedural code-- it's a
symptom of poor coding design/skill/style/ethic.

> look at C++, Java, and PHP.  these languages are all written in C;
> they are high level, and although php allows you to write proceedrual
> code, i think it is best used from an oop paradigm.

That really depends. Just because we prefer to code in OOP in PHP, does
not in anyway discount the merit of well written non OOP PHP code.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-25 Thread Nathan Nobbe
agreed :)

On 8/25/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
>
> On Sat, 2007-08-25 at 10:57 -0400, Nathan Nobbe wrote:
> > Robert,
> >
> > C is a low-level language whereas php is a high level language.
> > ill admit it openly, i am biased toward oop / design patterns.
> > and i think what i boils down to is what you view as 'icing'
> > i view as 'bread-and-butter' ;)
>
> I've pulled Larry out of the CC list BTW :)
>
> I also prefer OOP when developing in PHP.
>
> > personally i shudder when i see a big pile of usntructured code, or
> > a bunch of functions that are loosly organized, if at all.  this
> constitues
> > most php applications i have seen in the industry of which i have
> > been participating for roughly 3 yaers now.
>
> Oh I'd have to agree. Many things I've downloaded and looked at make me
> want to gag. But, that's not a symptom of procedural code-- it's a
> symptom of poor coding design/skill/style/ethic.
>
> > look at C++, Java, and PHP.  these languages are all written in C;
> > they are high level, and although php allows you to write proceedrual
> > code, i think it is best used from an oop paradigm.
>
> That really depends. Just because we prefer to code in OOP in PHP, does
> not in anyway discount the merit of well written non OOP PHP code.
>
> Cheers,
> Rob.
> --
> ...
> SwarmBuy.com - http://www.swarmbuy.com
>
> Leveraging the buying power of the masses!
> ...
>


[PHP] Does JavaScript not work in php web file?

2007-08-25 Thread Patrik Hasibuan
Dear my friends...

I am confused to implement JavaScript code in php web file.

I want my JavaScript change the "selected" item of  tag based on the 
"selected" item of previous  in same php page.

Please help me tell my where is my mistake.

===
Here is my code pelangganbaru.php
===




  

  guru.com - Menu for new customer


function opsi(){
if (document.formulir.opsinegara.value!="Virgina Islands (USA)";){
document.formulir.opsistate.options[0].selected=true;
}
}



";
}
?>






3. Country:





getkoneksi("survey",$sqlnya);
if ( mysql_num_rows($klas) > 0 ) {
while( list($negara) = mysql_fetch_row($klas) ) {
echo "$negara";
}
} else {
echo 'No results found';
}
?>





4. State:





getkoneksi("survey",$sqlnya);
if ( mysql_num_rows($klas) > 0 ) {
echo "";
if ($negara=="Virgin Islands (US)"){
echo "Non 
USA";
}else{
echo "Non USA";
}
while( list($state,$statename) = mysql_fetch_row($klas) ) {
echo "$statename 
($state)";
}
} else {
echo 'No results found';
}
?>


















-- 
Patrik Hasibuan <[EMAIL PROTECTED]>
Junior Programmer

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



Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-25 Thread Larry Garfield
On Saturday 25 August 2007, Robert Cummings wrote:

> Rewriting? You're assuming developers of PHP4 are using all of the
> features in PHP5 but written using PHP4 code. That's not a very valid
> assumption. You're also assuming they didn't already have code written
> in PHP4 that was then duplicated b internal code in PHP5. Hell, many
> PHP4 AND PHP5 developers don't even use OOP. Tell me what is compelling
> in PHP5 that doesn't rely on you being an OOP developer? Exceptions
> don't count since that's an individual bent. C has no exceptions and it
> gets on fine (PHP is written in it :)
>
> Cheers,
> Rob.

There is no way to respond to the above request, because you're automatically 
discounting features as "an individual bent".  That makes your position 
non-falsifiable (cannot be proven or disproven), and therefore irrelevant.

What does PHP 5 offer?

- Exceptions.  No you don't have to use them, but they are a useful tool.

- Real OOP.  No, you don't have to use it, but it is a useful tool.

- Prepared statements in MySQL (mysqli) or cross-database (PDO).  You really 
should be using them!

- filter extension.  No you don't have to use it, but it's a useful tool for 
security.

- SPL.  You can leverage SPL without having a fully-OOP architecture.  In 
fact, I find it most useful to be able to "have my procedural cake and OOP 
icing, too".  No, you don't have to use it, but it's a useful tool.

- SimpleXML and the DOM extension.  XML handling that doesn't suck ass.  No 
you don't have to use them, but if you're doing anything with XML processing 
you will thank the gods that you did.

- A few dozen new utility functions.  Sure they could be/have been 
reimplemented in PHP 4 user-space, but they're not as fast as when 
implemented in C.

That's just off the top of my head.  PHP 5 offers a ton of extra tools that 
can be useful in many situations.  

If you're on a PHP 4 server, you have no choice but to not use them.  

If you're on a PHP 5 server, you can pick and choose which to use based on 
your use case and preferences.

The GoPHP5 project is not about forcing people to use OOP.  It's about 
ensuring that developers have a full tool box available to them when writing 
code.  If you're still using PHP 4 now, then your tool box is only half-full.  
Get on PHP 5 to get the other half.  

The other factor is that those writing code that goes on servers they don't 
have absolute control over (I dare say most of us) are bound by *others'* 
refusal to upgrade to PHP 5.  If I'm on a shared host, I'm stuck with 
whatever that host is running, even if it's ancient.

Supporting PHP 4 hurts PHP 5 developers.  Supporting PHP 5 does not hurt PHP 4 
developers.  That's the problem.

For more info:

http://gophp5.org/faq

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

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



Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-25 Thread Robert Cummings
On Sat, 2007-08-25 at 11:09 -0500, Larry Garfield wrote:
> On Saturday 25 August 2007, Robert Cummings wrote:
> 
> > Rewriting? You're assuming developers of PHP4 are using all of the
> > features in PHP5 but written using PHP4 code. That's not a very valid
> > assumption. You're also assuming they didn't already have code written
> > in PHP4 that was then duplicated b internal code in PHP5. Hell, many
> > PHP4 AND PHP5 developers don't even use OOP. Tell me what is compelling
> > in PHP5 that doesn't rely on you being an OOP developer? Exceptions
> > don't count since that's an individual bent. C has no exceptions and it
> > gets on fine (PHP is written in it :)
> >
> > Cheers,
> > Rob.
> 
> There is no way to respond to the above request, because you're automatically 
> discounting features as "an individual bent".  That makes your position 
> non-falsifiable (cannot be proven or disproven), and therefore irrelevant.

I'm indicating that features should not be the sole basis of the
argument since they are indeed an individual bent. As such it helps to
focus the argument to what is important-- the efficacy of PHP4 versus
the efficacy of PHP5. Thus my position is open to falsifiability and not
as you say "irrelevant". 

> What does PHP 5 offer?
> 
> - Exceptions.  No you don't have to use them, but they are a useful tool.
>
> - Real OOP.  No, you don't have to use it, but it is a useful tool.

Ooh, the magical "Real OOP". Please go find me a definition
of "Real OOP". PHP4 is as real OOP as any other OOP. Just because it
lacks some devices available in other OOP implementation does not
disqualify it in any way from being OOP.

> - Prepared statements in MySQL (mysqli) or cross-database (PDO).  You really 
> should be using them!

There are pros and cons to prepared statements:

"Sometimes prepared statements can actually be slower than regular
queries. The reason for this is that there are two round-trips to the
server, which can slow down simple queries that are only executed a
single time. In cases like that, one has to decide if it is worth
trading off the performance impact of this extra round-trip in order to
gain the security benefits of using prepared statements."

Any conscious developer can properly escape their queries to be secure.
While PDO offers access to features that are not common to all DBs it
does so in a non-portable way as would be expected. As such it's just
another database abstraction layer. It's quite simple to write wrap this
in a pre-existing PHP encoded database abstraction layer.

> - filter extension.  No you don't have to use it, but it's a useful tool for 
> security.

Sure, but you can filter your variables for security without it.

> - SPL.  You can leverage SPL without having a fully-OOP architecture.  In 
> fact, I find it most useful to be able to "have my procedural cake and OOP 
> icing, too".  No, you don't have to use it, but it's a useful tool.

But it doesn't offer much to a fully procedural architecture.

> - SimpleXML and the DOM extension.  XML handling that doesn't suck ass.  No 
> you don't have to use them, but if you're doing anything with XML processing 
> you will thank the gods that you did.

I already have an XML API that works fine in PHP4.

> - A few dozen new utility functions.  Sure they could be/have been 
> reimplemented in PHP 4 user-space, but they're not as fast as when 
> implemented in C.

True, but that's a compatibility / performance tradeoff. And there
doesn't need to be a tradeoff. You can test for PHP4 and include the PHP
versions if PHP4 is active. Otherwise default to PHP5 C implementations.

> That's just off the top of my head.  PHP 5 offers a ton of extra tools that 
> can be useful in many situations.

Sure it offers a ton of extra tools, but there may be a ton of libraries
abandoned that haven't been made compatible with PHP5. Although I must
admit it's quite easy to make code PHP5 compatible.

> If you're on a PHP 4 server, you have no choice but to not use them.  
> 
> If you're on a PHP 5 server, you can pick and choose which to use based on 
> your use case and preferences.
> 
> The GoPHP5 project is not about forcing people to use OOP.  It's about 
> ensuring that developers have a full tool box available to them when writing 
> code.  If you're still using PHP 4 now, then your tool box is only half-full. 
>  
> Get on PHP 5 to get the other half.

I never said gophp5 was about forcing the use of OOP. It just strikes me
as an unnecessary push when market forces will perform the appropriate
pushing at the appropriate time. GOPHP5 is an artifical push for a
faster move towards an inevitable future.

> The other factor is that those writing code that goes on servers they don't 
> have absolute control over (I dare say most of us) are bound by *others'* 
> refusal to upgrade to PHP 5.  If I'm on a shared host, I'm stuck with 
> whatever that host is running, even if it's ancient.

I've nothing against running your 

Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-25 Thread Nathan Nobbe
i know this thread started off about a performance comparison, but it is
already grown into much more.
suffice it to say that i consider the oop capacity of php4 nothing more than
a stepping stone on the way
to php5.  i dont know of all the oop languages out there.  mostly i have
worked w/ c++ and java
(and a little .net and a tiny bit of delphi) when it comes to oop.
all of those languages have ppp; which i consider to be fundamental to an
oop language; but alas
php is not an oop language; it merely supporst features of an oop language.
 per statements on php.net.

then again javascript is supposedly oop, and i know it doesnt support ppp;
so we would really have to
dig deeper for a definition of 'basic oop' / 'true oop' etc.

from a personal standpoint i have been leraning how to leverage the power of
the interface construct
for 1.  on top of that, well i think no ppp is madness... but again, thats
nothing formal :)

-nathan

On 8/25/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
>
> On Sat, 2007-08-25 at 11:09 -0500, Larry Garfield wrote:
> > On Saturday 25 August 2007, Robert Cummings wrote:
> >
> > > Rewriting? You're assuming developers of PHP4 are using all of the
> > > features in PHP5 but written using PHP4 code. That's not a very valid
> > > assumption. You're also assuming they didn't already have code written
> > > in PHP4 that was then duplicated b internal code in PHP5. Hell, many
> > > PHP4 AND PHP5 developers don't even use OOP. Tell me what is
> compelling
> > > in PHP5 that doesn't rely on you being an OOP developer? Exceptions
> > > don't count since that's an individual bent. C has no exceptions and
> it
> > > gets on fine (PHP is written in it :)
> > >
> > > Cheers,
> > > Rob.
> >
> > There is no way to respond to the above request, because you're
> automatically
> > discounting features as "an individual bent".  That makes your position
> > non-falsifiable (cannot be proven or disproven), and therefore
> irrelevant.
>
> I'm indicating that features should not be the sole basis of the
> argument since they are indeed an individual bent. As such it helps to
> focus the argument to what is important-- the efficacy of PHP4 versus
> the efficacy of PHP5. Thus my position is open to falsifiability and not
> as you say "irrelevant".
>
> > What does PHP 5 offer?
> >
> > - Exceptions.  No you don't have to use them, but they are a useful
> tool.
> >
> > - Real OOP.  No, you don't have to use it, but it is a useful tool.
>
> Ooh, the magical "Real OOP". Please go find me a definition
> of "Real OOP". PHP4 is as real OOP as any other OOP. Just because it
> lacks some devices available in other OOP implementation does not
> disqualify it in any way from being OOP.
>
> > - Prepared statements in MySQL (mysqli) or cross-database (PDO).  You
> really
> > should be using them!
>
> There are pros and cons to prepared statements:
>
> "Sometimes prepared statements can actually be slower than regular
> queries. The reason for this is that there are two round-trips to the
> server, which can slow down simple queries that are only executed a
> single time. In cases like that, one has to decide if it is worth
> trading off the performance impact of this extra round-trip in order to
> gain the security benefits of using prepared statements."
>
> Any conscious developer can properly escape their queries to be secure.
> While PDO offers access to features that are not common to all DBs it
> does so in a non-portable way as would be expected. As such it's just
> another database abstraction layer. It's quite simple to write wrap this
> in a pre-existing PHP encoded database abstraction layer.
>
> > - filter extension.  No you don't have to use it, but it's a useful tool
> for
> > security.
>
> Sure, but you can filter your variables for security without it.
>
> > - SPL.  You can leverage SPL without having a fully-OOP
> architecture.  In
> > fact, I find it most useful to be able to "have my procedural cake and
> OOP
> > icing, too".  No, you don't have to use it, but it's a useful tool.
>
> But it doesn't offer much to a fully procedural architecture.
>
> > - SimpleXML and the DOM extension.  XML handling that doesn't suck
> ass.  No
> > you don't have to use them, but if you're doing anything with XML
> processing
> > you will thank the gods that you did.
>
> I already have an XML API that works fine in PHP4.
>
> > - A few dozen new utility functions.  Sure they could be/have been
> > reimplemented in PHP 4 user-space, but they're not as fast as when
> > implemented in C.
>
> True, but that's a compatibility / performance tradeoff. And there
> doesn't need to be a tradeoff. You can test for PHP4 and include the PHP
> versions if PHP4 is active. Otherwise default to PHP5 C implementations.
>
> > That's just off the top of my head.  PHP 5 offers a ton of extra tools
> that
> > can be useful in many situations.
>
> Sure it offers a ton of extra tools, but there may be a ton of libraries
> abandon

RE: [PHP] Does JavaScript not work in php web file?

2007-08-25 Thread Sanjeev N
Hi,

JavaScript codes works in php files. Yours code is also fine. 
But check your calling function and defined functions. Calling function is
jsopsi and defined function is opsi. Please check. Other than this
everything is ok

Warm Regards,
Sanjeev
http://www.sanchanworld.com/
http://webdirectory.sanchanworld.com - Submit your website URL
http://webhosting.sanchanworld.com - Choose your best web hosting plan
-Original Message-
From: Patrik Hasibuan [mailto:[EMAIL PROTECTED] 
Sent: Saturday, August 25, 2007 9:17 PM
To: php-general@lists.php.net
Subject: [PHP] Does JavaScript not work in php web file?

Dear my friends...

I am confused to implement JavaScript code in php web file.

I want my JavaScript change the "selected" item of  tag based on the
"selected" item of previous  in same php page.

Please help me tell my where is my mistake.

===
Here is my code pelangganbaru.php
===




  

  guru.com - Menu for new customer


function opsi(){
if (document.formulir.opsinegara.value!="Virgina Islands (USA)";){
document.formulir.opsistate.options[0].selected=true;
}
}



";
}
?>






3. Country:





getkoneksi("survey",$sqlnya);
if ( mysql_num_rows($klas) > 0 ) {
while( list($negara) = mysql_fetch_row($klas) ) {
echo "$negara";
}
} else {
echo 'No results found';
}
?>





4. State:





getkoneksi("survey",$sqlnya);
if ( mysql_num_rows($klas) > 0 ) {
echo "";
if ($negara=="Virgin Islands (US)"){
echo "Non
USA";
}else{
echo "Non
USA";
}
while( list($state,$statename) = mysql_fetch_row($klas) ) {
echo "$statename
($state)";
}
} else {
echo 'No results found';
}
?>


















-- 
Patrik Hasibuan <[EMAIL PROTECTED]>
Junior Programmer

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

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



Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-25 Thread Larry Garfield
Robert and everyone: PLEASE do not reply to list AND the sender, at least not 
when I'm the sender.  I don't need double copies of every message in every 
thread I participate in.  Thanks.

On Saturday 25 August 2007, Robert Cummings wrote:

> > There is no way to respond to the above request, because you're
> > automatically discounting features as "an individual bent".  That makes
> > your position non-falsifiable (cannot be proven or disproven), and
> > therefore irrelevant.
>
> I'm indicating that features should not be the sole basis of the
> argument since they are indeed an individual bent. As such it helps to
> focus the argument to what is important-- the efficacy of PHP4 versus
> the efficacy of PHP5. Thus my position is open to falsifiability and not
> as you say "irrelevant".
>
> > What does PHP 5 offer?
> >
> > - Exceptions.  No you don't have to use them, but they are a useful tool.
> >
> > - Real OOP.  No, you don't have to use it, but it is a useful tool.
>
> Ooh, the magical "Real OOP". Please go find me a definition
> of "Real OOP". PHP4 is as real OOP as any other OOP. Just because it
> lacks some devices available in other OOP implementation does not
> disqualify it in any way from being OOP.
>
> > - Prepared statements in MySQL (mysqli) or cross-database (PDO).  You
> > really should be using them!
>
> There are pros and cons to prepared statements:

Sure there are.  But if all you have is the mysql_ extension, you don't get to 
make that choice.  

> > - filter extension.  No you don't have to use it, but it's a useful tool
> > for security.
>
> Sure, but you can filter your variables for security without it.

Sure you can.  You could do it in C, too, and then you don't need PHP's 
overhead.  The "you can accomplish it without this tool" argument carries no 
weight since the whole point of the tool is "but I can accomplish it in far 
less time with less code and fewer bugs with it".  

You can build a house using nothing but a hand saw, but a buzz saw makes it oh 
so much easier. :-)

> > - SPL.  You can leverage SPL without having a fully-OOP architecture.  In
> > fact, I find it most useful to be able to "have my procedural cake and
> > OOP icing, too".  No, you don't have to use it, but it's a useful tool.
>
> But it doesn't offer much to a fully procedural architecture.

Have you tried it?

> > - SimpleXML and the DOM extension.  XML handling that doesn't suck ass. 
> > No you don't have to use them, but if you're doing anything with XML
> > processing you will thank the gods that you did.
>
> I already have an XML API that works fine in PHP4.

There's only a narrow sliver of use cases where I'd say PHP 4's primitive SAX 
parser "works fine".  Perhaps you're only working in those, but if you're 
doing anything more complex then the extra tools make life a hell of a lot 
easier.

> > - A few dozen new utility functions.  Sure they could be/have been
> > reimplemented in PHP 4 user-space, but they're not as fast as when
> > implemented in C.
>
> True, but that's a compatibility / performance tradeoff. And there
> doesn't need to be a tradeoff. You can test for PHP4 and include the PHP
> versions if PHP4 is active. Otherwise default to PHP5 C implementations.

You have to be careful how you structure the code, though.  Conditional 
function definitions still get compiled even if they aren't "defined", so 
there's no memory savings.

> > The GoPHP5 project is not about forcing people to use OOP.  It's about
> > ensuring that developers have a full tool box available to them when
> > writing code.  If you're still using PHP 4 now, then your tool box is
> > only half-full. Get on PHP 5 to get the other half.
>
> I never said gophp5 was about forcing the use of OOP. It just strikes me
> as an unnecessary push when market forces will perform the appropriate
> pushing at the appropriate time. GOPHP5 is an artifical push for a
> faster move towards an inevitable future.

GoPHP5 *is that market force*.  It's developers saying "OK, we're sick of PHP 
4, it's time for PHP 5, get with the program".  Hosts that don't keep up, 
well, that's capitalism.  It's well past the "appropriate time".  

And actually, what I've found from GoPHP5 is that the Nexen stats showing 20% 
PHP 5 deployment on a good day are bunk.  There's no shortage of PHP 5 
compatible hosts, including the big names.  We've been holding ourselves back 
needlessly.

> > The other factor is that those writing code that goes on servers they
> > don't have absolute control over (I dare say most of us) are bound by
> > *others'* refusal to upgrade to PHP 5.  If I'm on a shared host, I'm
> > stuck with whatever that host is running, even if it's ancient.
>
> I've nothing against running your stuff in PHP5, nothing against it at
> all. But I don't see what the problem is with maintaining PHP4
> compatibility while enjoying PHP5 if you so choose to use PHP5.

Because it is not possible to use SimpleXML or SPL or PDO etc. whi

Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-25 Thread Robert Cummings
On Sat, 2007-08-25 at 12:28 -0500, Larry Garfield wrote:
> Robert and everyone: PLEASE do not reply to list AND the sender, at least not 
> when I'm the sender.  I don't need double copies of every message in every 
> thread I participate in.  Thanks.

Sorry I've been hitting reply-all since I first used email in '93. I
have my doubts I can seriously change my habits now. I've done so this
one time just for you though :)


> On Saturday 25 August 2007, Robert Cummings wrote:


> Sure you can.  You could do it in C, too, and then you don't need PHP's 
> overhead.  The "you can accomplish it without this tool" argument carries no 
> weight since the whole point of the tool is "but I can accomplish it in far 
> less time with less code and fewer bugs with it".  
> 
> You can build a house using nothing but a hand saw, but a buzz saw makes it 
> oh 
> so much easier. :-)

PHP4 is the buzz saw. PHP5 is the buzz saw with some extras.

> > > - SPL.  You can leverage SPL without having a fully-OOP architecture.  In
> > > fact, I find it most useful to be able to "have my procedural cake and
> > > OOP icing, too".  No, you don't have to use it, but it's a useful tool.
> >
> > But it doesn't offer much to a fully procedural architecture.
> 
> Have you tried it?

Yes I've tried procedural development. it's fun, can be a bit tedious
passing around arrays, but altogether not bad.

> > > - SimpleXML and the DOM extension.  XML handling that doesn't suck ass. 
> > > No you don't have to use them, but if you're doing anything with XML
> > > processing you will thank the gods that you did.
> >
> > I already have an XML API that works fine in PHP4.
> 
> There's only a narrow sliver of use cases where I'd say PHP 4's primitive SAX 
> parser "works fine".  Perhaps you're only working in those, but if you're 
> doing anything more complex then the extra tools make life a hell of a lot 
> easier.

I have a wrapper around the parser. I access fields using a very simple
path string.

$xml->getLiteral( '/response/products/[EMAIL PROTECTED]' );

or

$xml->focus( '/response/products/product' );
$products = $xml->getIndexes();
foreach( $products as $pi )
{
echo 'Status: '.$xml->getLiteral( "[EMAIL PROTECTED]" );
}

It works very well on very complex XML.

> > > - A few dozen new utility functions.  Sure they could be/have been
> > > reimplemented in PHP 4 user-space, but they're not as fast as when
> > > implemented in C.
> >
> > True, but that's a compatibility / performance tradeoff. And there
> > doesn't need to be a tradeoff. You can test for PHP4 and include the PHP
> > versions if PHP4 is active. Otherwise default to PHP5 C implementations.
> 
> You have to be careful how you structure the code, though.  Conditional 
> function definitions still get compiled even if they aren't "defined", so 
> there's no memory savings.

They don't get compiled if you conditionally include the files that have
them.

> > > The GoPHP5 project is not about forcing people to use OOP.  It's about
> > > ensuring that developers have a full tool box available to them when
> > > writing code.  If you're still using PHP 4 now, then your tool box is
> > > only half-full. Get on PHP 5 to get the other half.
> >
> > I never said gophp5 was about forcing the use of OOP. It just strikes me
> > as an unnecessary push when market forces will perform the appropriate
> > pushing at the appropriate time. GOPHP5 is an artifical push for a
> > faster move towards an inevitable future.
> 
> GoPHP5 *is that market force*.  It's developers saying "OK, we're sick of PHP 
> 4, it's time for PHP 5, get with the program".  Hosts that don't keep up, 
> well, that's capitalism.  It's well past the "appropriate time".  

No, GoPHP5 is an external force attempting to sway the market. If you
were THE market force then PHP5 would already be the majority version
and GoPHP5 would be moot.

> And actually, what I've found from GoPHP5 is that the Nexen stats showing 20% 
> PHP 5 deployment on a good day are bunk.  There's no shortage of PHP 5 
> compatible hosts, including the big names.  We've been holding ourselves back 
> needlessly.
> 
> > > The other factor is that those writing code that goes on servers they
> > > don't have absolute control over (I dare say most of us) are bound by
> > > *others'* refusal to upgrade to PHP 5.  If I'm on a shared host, I'm
> > > stuck with whatever that host is running, even if it's ancient.
> >
> > I've nothing against running your stuff in PHP5, nothing against it at
> > all. But I don't see what the problem is with maintaining PHP4
> > compatibility while enjoying PHP5 if you so choose to use PHP5.
> 
> Because it is not possible to use SimpleXML or SPL or PDO etc. while 
> maintaining PHP 4 compatibility, unless you write two completely separate 
> implementations with a common facade.

But if you already have those implementations because you're coming from
PHP4, then who cares. If I already have a hu

Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-25 Thread Nathan Nobbe
i dont know what all this goPHP5 stuff is about.
all i know is there was an announcment on php.net a few weeks back saying
php4 is deprecated and it soon will be made obsolete.

-nathan

On 8/25/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
>
> On Sat, 2007-08-25 at 12:28 -0500, Larry Garfield wrote:
> > Robert and everyone: PLEASE do not reply to list AND the sender, at
> least not
> > when I'm the sender.  I don't need double copies of every message in
> every
> > thread I participate in.  Thanks.
>
> Sorry I've been hitting reply-all since I first used email in '93. I
> have my doubts I can seriously change my habits now. I've done so this
> one time just for you though :)
>
>
> > On Saturday 25 August 2007, Robert Cummings wrote:
>
>
> > Sure you can.  You could do it in C, too, and then you don't need PHP's
> > overhead.  The "you can accomplish it without this tool" argument
> carries no
> > weight since the whole point of the tool is "but I can accomplish it in
> far
> > less time with less code and fewer bugs with it".
> >
> > You can build a house using nothing but a hand saw, but a buzz saw makes
> it oh
> > so much easier. :-)
>
> PHP4 is the buzz saw. PHP5 is the buzz saw with some extras.
>
> > > > - SPL.  You can leverage SPL without having a fully-OOP
> architecture.  In
> > > > fact, I find it most useful to be able to "have my procedural cake
> and
> > > > OOP icing, too".  No, you don't have to use it, but it's a useful
> tool.
> > >
> > > But it doesn't offer much to a fully procedural architecture.
> >
> > Have you tried it?
>
> Yes I've tried procedural development. it's fun, can be a bit tedious
> passing around arrays, but altogether not bad.
>
> > > > - SimpleXML and the DOM extension.  XML handling that doesn't suck
> ass.
> > > > No you don't have to use them, but if you're doing anything with XML
> > > > processing you will thank the gods that you did.
> > >
> > > I already have an XML API that works fine in PHP4.
> >
> > There's only a narrow sliver of use cases where I'd say PHP 4's
> primitive SAX
> > parser "works fine".  Perhaps you're only working in those, but if
> you're
> > doing anything more complex then the extra tools make life a hell of a
> lot
> > easier.
>
> I have a wrapper around the parser. I access fields using a very simple
> path string.
>
> $xml->getLiteral( '/response/products/[EMAIL PROTECTED]' );
>
> or
>
> $xml->focus( '/response/products/product' );
> $products = $xml->getIndexes();
> foreach( $products as $pi )
> {
> echo 'Status: '.$xml->getLiteral( "[EMAIL PROTECTED]" );
> }
>
> It works very well on very complex XML.
>
> > > > - A few dozen new utility functions.  Sure they could be/have been
> > > > reimplemented in PHP 4 user-space, but they're not as fast as when
> > > > implemented in C.
> > >
> > > True, but that's a compatibility / performance tradeoff. And there
> > > doesn't need to be a tradeoff. You can test for PHP4 and include the
> PHP
> > > versions if PHP4 is active. Otherwise default to PHP5 C
> implementations.
> >
> > You have to be careful how you structure the code, though.  Conditional
> > function definitions still get compiled even if they aren't "defined",
> so
> > there's no memory savings.
>
> They don't get compiled if you conditionally include the files that have
> them.
>
> > > > The GoPHP5 project is not about forcing people to use OOP.  It's
> about
> > > > ensuring that developers have a full tool box available to them when
> > > > writing code.  If you're still using PHP 4 now, then your tool box
> is
> > > > only half-full. Get on PHP 5 to get the other half.
> > >
> > > I never said gophp5 was about forcing the use of OOP. It just strikes
> me
> > > as an unnecessary push when market forces will perform the appropriate
> > > pushing at the appropriate time. GOPHP5 is an artifical push for a
> > > faster move towards an inevitable future.
> >
> > GoPHP5 *is that market force*.  It's developers saying "OK, we're sick
> of PHP
> > 4, it's time for PHP 5, get with the program".  Hosts that don't keep
> up,
> > well, that's capitalism.  It's well past the "appropriate time".
>
> No, GoPHP5 is an external force attempting to sway the market. If you
> were THE market force then PHP5 would already be the majority version
> and GoPHP5 would be moot.
>
> > And actually, what I've found from GoPHP5 is that the Nexen stats
> showing 20%
> > PHP 5 deployment on a good day are bunk.  There's no shortage of PHP 5
> > compatible hosts, including the big names.  We've been holding ourselves
> back
> > needlessly.
> >
> > > > The other factor is that those writing code that goes on servers
> they
> > > > don't have absolute control over (I dare say most of us) are bound
> by
> > > > *others'* refusal to upgrade to PHP 5.  If I'm on a shared host, I'm
> > > > stuck with whatever that host is running, even if it's ancient.
> > >
> > > I've nothing against running your stuff in PHP5, nothing agains

Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-25 Thread Larry Garfield
On Saturday 25 August 2007, Nathan Nobbe wrote:
> i dont know what all this goPHP5 stuff is about.
> all i know is there was an announcment on php.net a few weeks back saying
> php4 is deprecated and it soon will be made obsolete.
>
> -nathan

That announcement came a week after this site launched:

http://gophp5.org/

I do not know what if any role it played in the PHP Internals folks' decision 
to EOL PHP 4, but with or without it the bulk of the PHP world is already 
committed to moving to PHP 5.2 anyway.

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

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



Re: [PHP] PHP4 vs PHP5 Performance?

2007-08-25 Thread Robert Cummings
On Sat, 2007-08-25 at 14:26 -0500, Larry Garfield wrote:
> On Saturday 25 August 2007, Nathan Nobbe wrote:
> > i dont know what all this goPHP5 stuff is about.
> > all i know is there was an announcment on php.net a few weeks back saying
> > php4 is deprecated and it soon will be made obsolete.
> >
> > -nathan
> 
> That announcement came a week after this site launched:
> 
> http://gophp5.org/
> 
> I do not know what if any role it played in the PHP Internals folks' decision 
> to EOL PHP 4, but with or without it the bulk of the PHP world is already 
> committed to moving to PHP 5.2 anyway.

Maybe it should be GoPHP5.2 ;) I don't think anyone seriously would say
Go anything less that 5.2 since there are so many issues before that.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



[PHP] Calling functions which names are inside a variable

2007-08-25 Thread Robert Keizer
I am currently working on a module testing class, I can't seem to find the  
correct syntax. Here is an example of the problem:


function foo( $var ){
include $var.'.php';
return $var(); // 

Re: [PHP] Calling functions which names are inside a variable

2007-08-25 Thread Robert Cummings
On Sat, 2007-08-25 at 23:46 -0600, Robert Keizer wrote:
> I am currently working on a module testing class, I can't seem to find the  
> correct syntax. Here is an example of the problem:
> 
> function foo( $var ){
>   include $var.'.php';
>   return $var(); // 

[PHP] determine which string is longer and then what is different in that string

2007-08-25 Thread Richard Kurth
I am trying to find out which string is the longest and then find out what
is different between the two string. Sometimes String 2 is longer than
String 1 The script below works sometimes but not all the time.
Is there a better way to do this or tell me what is wrong with the script I
am using
 
$string1 = "1,2,3,4,5,6,7,8";
$string2 = "1,2,3,4,6,7,8"; 
 
 
 
function compare_by_length ($a, $b)
{
$la = strlen ($a);
$lb = strlen ($b);
if ($la == $lb) return (0);
return ($a > $b) ? 1 : 2;
}
 
$string1 = "1,2,3,4,5,6,7,8";
$string2 = "1,2,3,4,6,7,8"; 
 
$longstring=compare_by_length ($string1, $string2);
 
if ($longstring=="0"){
  echo "nochange" . $longstring;
  echo"";
}
if ($longstring=="1"){
  echo "List " . $longstring;
  echo"";
  $array1 = explode(",", $string1);
  $array2 = explode(",", $string2);
}
if ($longstring=="2"){
  echo "List " . $longstring;
  echo"";
  $array1 = explode(",", $string2);
  $array2 = explode(",", $string1);
 
}
 
   for ($i = 0; $i < count($array1); $i++) {
  $associative_array[$array1[$i]] = 1;
   }
   
   // print "Not a member of the following lists:\n";
   for ($i = 0; $i < count($array2); $i++) {
  if (!$associative_array[$array2[$i]]) {
 print "$array2[$i]\n";
  }
   }


[PHP] Re: Calling functions which names are inside a variable

2007-08-25 Thread Robert Keizer
Thats great thanks, but it doesn't solve my problem completly, im trying to 
use $output = $var(); .. which gives me an error. The $var(); works though, 
so thanks for that.

Robert Keizer
""Robert Keizer"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I am currently working on a module testing class, I can't seem to find the 
>correct syntax. Here is an example of the problem:
>
> function foo( $var ){
> include $var.'.php';
> return $var(); //  [EMAIL PROTECTED] 

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



[PHP] Re: determine which string is longer and then what is different in that string

2007-08-25 Thread Robert Keizer
Okay, why not try somthing like this:

$string1 = "1,2,3,4,5,6,7,8";
$string2 = "2,4,6,8,10";

$ary1 = implode(",",$string1);
$ary2 = implode(",",$string2);

$num1 = '';
$num2 = '';
foreach($ary1 as $num){
$num1 .= $num;
}
foreach($ary2 as $num){
$num2 .= $num;
}

that would get the strings into "12345678" and "246810" respectfully, so you 
could do simple add, subtract, greater than, less than, etc... hope this was 
helpful.

Robert Keizer
""Richard Kurth"" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I am trying to find out which string is the longest and then find out what
> is different between the two string. Sometimes String 2 is longer than
> String 1 The script below works sometimes but not all the time.
> Is there a better way to do this or tell me what is wrong with the script 
> I
> am using
>
> $string1 = "1,2,3,4,5,6,7,8";
> $string2 = "1,2,3,4,6,7,8";
>
>
>
> function compare_by_length ($a, $b)
> {
>$la = strlen ($a);
>$lb = strlen ($b);
>if ($la == $lb) return (0);
>return ($a > $b) ? 1 : 2;
> }
>
> $string1 = "1,2,3,4,5,6,7,8";
> $string2 = "1,2,3,4,6,7,8";
>
> $longstring=compare_by_length ($string1, $string2);
>
> if ($longstring=="0"){
>  echo "nochange" . $longstring;
>  echo"";
> }
> if ($longstring=="1"){
>  echo "List " . $longstring;
>  echo"";
>  $array1 = explode(",", $string1);
>  $array2 = explode(",", $string2);
> }
> if ($longstring=="2"){
>  echo "List " . $longstring;
>  echo"";
>  $array1 = explode(",", $string2);
>  $array2 = explode(",", $string1);
>
> }
>
>   for ($i = 0; $i < count($array1); $i++) {
>  $associative_array[$array1[$i]] = 1;
>   }
>
>   // print "Not a member of the following lists:\n";
>   for ($i = 0; $i < count($array2); $i++) {
>  if (!$associative_array[$array2[$i]]) {
> print "$array2[$i]\n";
>  }
>   }
> 

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



RE: [PHP] Calling functions which names are inside a variable

2007-08-25 Thread Sanjeev N
I tested this functionality.

This is working fine.

 

foo.php



somefunction.php



Out put is hello.

 

You make sure that your both files are in same folder and make sure that
$var.'.php' is exist with $var function.

 

Warm Regards,

Sanjeev

http://www.sanchanworld.com/

http://webdirectory.sanchanworld.com - Submit your website URL

http://webhosting.sanchanworld.com - Choose your best web hosting plan

-Original Message-
From: Robert Keizer [mailto:[EMAIL PROTECTED] 
Sent: Sunday, August 26, 2007 11:16 AM
To: php-general@lists.php.net
Subject: [PHP] Calling functions which names are inside a variable

 

I am currently working on a module testing class, I can't seem to find the  

correct syntax. Here is an example of the problem:

 

function foo( $var ){

  include $var.'.php';

  return $var(); // 

RE: [PHP] determine which string is longer and then what is different in that string

2007-08-25 Thread Sanjeev N
Hi Richard,

I am trying to get your actual problem.
First, you want to compare 2 strings and want to check what the difference
between these 2 strings is. I assuming string may contain either numbers or
any characters.

Second, you are trying to compare the numbers.

But I am thinking that your problem is first case.
Then first you check the length, and then check character by character
(check each position, if different character at same position means changed)
for each string.

Warm Regards,
Sanjeev
http://www.sanchanworld.com/
http://webdirectory.sanchanworld.com - Submit your website URL
http://webhosting.sanchanworld.com - Choose your best web hosting plan

-Original Message-
From: Richard Kurth [mailto:[EMAIL PROTECTED] 
Sent: Sunday, August 26, 2007 11:41 AM
To: php-general@lists.php.net
Subject: [PHP] determine which string is longer and then what is different
in that string

I am trying to find out which string is the longest and then find out what
is different between the two string. Sometimes String 2 is longer than
String 1 The script below works sometimes but not all the time.
Is there a better way to do this or tell me what is wrong with the script I
am using
 
$string1 = "1,2,3,4,5,6,7,8";
$string2 = "1,2,3,4,6,7,8"; 
 
 
 
function compare_by_length ($a, $b)
{
$la = strlen ($a);
$lb = strlen ($b);
if ($la == $lb) return (0);
return ($a > $b) ? 1 : 2;
}
 
$string1 = "1,2,3,4,5,6,7,8";
$string2 = "1,2,3,4,6,7,8"; 
 
$longstring=compare_by_length ($string1, $string2);
 
if ($longstring=="0"){
  echo "nochange" . $longstring;
  echo"";
}
if ($longstring=="1"){
  echo "List " . $longstring;
  echo"";
  $array1 = explode(",", $string1);
  $array2 = explode(",", $string2);
}
if ($longstring=="2"){
  echo "List " . $longstring;
  echo"";
  $array1 = explode(",", $string2);
  $array2 = explode(",", $string1);
 
}
 
   for ($i = 0; $i < count($array1); $i++) {
  $associative_array[$array1[$i]] = 1;
   }
   
   // print "Not a member of the following lists:\n";
   for ($i = 0; $i < count($array2); $i++) {
  if (!$associative_array[$array2[$i]]) {
 print "$array2[$i]\n";
  }
   }

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