php-general Digest 13 May 2001 08:37:21 -0000 Issue 683

Topics (messages 52588 through 52614):

Re: Repeat : I'm Living in cookie hell....
        52588 by: Scott Brown

Re: referencing a constant inside an object
        52589 by: Michael Kimsal

Re: Site search engine suggestion.
        52590 by: Ethan Schroeder
        52591 by: Philip Olson

Re: checking the mp3 bitrate
        52592 by: Alexander Skwar

Getting the domain from an url?
        52593 by: John Vanderbeck
        52594 by: CC Zona
        52606 by: Michael Kimsal

Re: PHP Editor
        52595 by: Jithy

check if a variable is in a number of states.
        52596 by: DRN
        52597 by: Ethan Schroeder
        52604 by: Philip Olson
        52611 by: Steve

PHP's OO is bad?
        52598 by: Mitch Vincent
        52607 by: Michael Kimsal
        52609 by: Sean Cazzell

Re: Simulate the Enter key in Unix with PHP
        52599 by: YoBro

A question on how to get the root directory
        52600 by: C Benn

Re: cobalt raq4
        52601 by: Herman Tolentino

Making sure a class is declared only once
        52602 by: rodrigo
        52603 by: Zak Greant

Re-directing
        52605 by: Todd Cary
        52608 by: Young Chi-Yeung Fan

modifying file via html page input
        52610 by: Dennis Gearon

References
        52612 by: Steve

imap_fetch_overview Question
        52613 by: Chris Cowan

Search engines and mod_rewrite
        52614 by: Tom Carter

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------



Thanks for your reply.

Unfortunately, the problem is not in getting the code to execute - I know it
is for two reasons:

1) the setcookie(...) is being triggered because I have cookie warnings
turned on in the browser, and it warns me that a new cookie is being
received.... and it shows me the expected content of the cookie

2) the reloacation via the header is occuring as expected.

It's just that the cookie being set isnt being retained on the browser....

(oh - and as a side note, there would only ever be 1 match for the returned
mysql result... which is why I didnt loop through them... there's either a
row returned, or not... and if not, then the rest of the code that wasnt
included in the msg handles that situation)

What I'm wondering though, is.... in the page which sets the cookie ok,
there is no redirection.... it executes:

        setcookie("YONKAMEMBERID",$insert_id,time()+31536000,"/",$PHP_HOST);

inline, and then displays the page.

In the page which doesnt set the cookie, there is redirection occuring

        setcookie("YONKAMEMBERID",$login_id,time()+31536000,"/",$PHP_HOST);
        Header("Refresh: 0;url=/");

It's the exact same code -- just a different variable setting the value, and
the header call afterwards. (though even when I comment out the header(..)
it still doesnt work.)

Something just isnt right somewhere.

Is it the path of the script being exeuted that's causing something strange
to occur??

I really am at a loss....

> Hello Scott,
>
> I took a look at your code, and have a solution for you.
>
> Here's the code:
>
> while ($row = mysql_fetch_array($result) )
> {
>       if ($row["memberid"] == $login_id)
>       {
>               // your code here :-)
>       }
> }
>
> >
> >        $row = mysql_fetch_array($result); // Get one row of
> data only *BAD*
> >        if ($row[memberid] == $login_id) {
> >             // [...]
> >        }
> >
> > the path of the cookie to be the root under both instances,
> it should be
> > trying to set the same cookie, right?
>
> correct, but this only works if the first array returned is
> equal to the
> login_id. since you are returning only the first row of your database
> table, you never make it to the memberid that you're hoping
> is there --
> assumming that it is there.
>
> Train harder!
>
> regards,barce
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
>
>





The other poster was correct in their reply, but a more fitting reply is
that $PHP_SELF is NOT a "constant".  A constant would be something like...

define(PHP_SELF,"cow");

All PHP code would then show PHP_SELF as "cow".


cw wrote:

> I'm trying to reference $PHP_SELF and $REMOTE_USER inside a class:
>
> var $page;
> var $user;
> $this->page=$PHP_SELF;
> $this->user=$REMOTE_USER;
>
> I'm using php4. What am I missing here?





Wow, thanks for the heads up =)

Ethan Schroeder

----- Original Message -----
From: "Ryan W. Zajicek" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, May 12, 2001 12:50 PM
Subject: RE: [PHP] Site search engine suggestion.


> Just a side not here... :)
>
> udmSearch is now mnoGoSearch (http://search.mnogo.ru/)
>
> Thank You
>
> Ryan
> mailto:[EMAIL PROTECTED]
>
>
> -----Original Message-----
> From: Ethan Schroeder [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, May 12, 2001 2:25 PM
> To: elias
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Site search engine suggestion.
>
>
> I use udmsearch and love it.  If you want php pages searchable it does
> actual http requests, so it doesn't give source code.  If you don't want
php
> searchable, you can configure it to ignore any file extensions you want.
It
> comes with a php interface built in, also.
>
> Ethan Schroeder
> ----- Original Message -----
> From: "elias" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, May 12, 2001 10:18 AM
> Subject: [PHP] Site search engine suggestion.
>
>
> > Hello guys,
> >
> > I need that badly! I need a suggestion, advise, solution or whatever
that
> > might help!
> >
> > I need a Site Search script for a page that mostly have .PHP files some
> are
> > dynamic and some are not.
> > Basically i was using WebGlimpse but whenever I search using it, It
shows
> > the source code of the PHP files!
> > So for example if i search "echo" , WebGlimpse displays the .PHP file
> source
> > code!
> >
> > Any suggestion for a better site search program?
> >
> > -elias
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





You may also find this interesting :

  http://php.net/manual/en/ref.mnogo.php
  
>From php changelog 4.0.5 :

  Added mnoGoSearch extension - http://search.mnogo.ru. (Sergey K)

regards,
philip



On Sat, 12 May 2001, Ethan Schroeder wrote:

> Wow, thanks for the heads up =)
> 
> Ethan Schroeder
> 
> ----- Original Message -----
> From: "Ryan W. Zajicek" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, May 12, 2001 12:50 PM
> Subject: RE: [PHP] Site search engine suggestion.
> 
> 
> > Just a side not here... :)
> >
> > udmSearch is now mnoGoSearch (http://search.mnogo.ru/)
> >
> > Thank You
> >
> > Ryan
> > mailto:[EMAIL PROTECTED]
> >
> >
> > -----Original Message-----
> > From: Ethan Schroeder [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, May 12, 2001 2:25 PM
> > To: elias
> > Cc: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Site search engine suggestion.
> >
> >
> > I use udmsearch and love it.  If you want php pages searchable it does
> > actual http requests, so it doesn't give source code.  If you don't want
> php
> > searchable, you can configure it to ignore any file extensions you want.
> It
> > comes with a php interface built in, also.
> >
> > Ethan Schroeder
> > ----- Original Message -----
> > From: "elias" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Saturday, May 12, 2001 10:18 AM
> > Subject: [PHP] Site search engine suggestion.
> >
> >
> > > Hello guys,
> > >
> > > I need that badly! I need a suggestion, advise, solution or whatever
> that
> > > might help!
> > >
> > > I need a Site Search script for a page that mostly have .PHP files some
> > are
> > > dynamic and some are not.
> > > Basically i was using WebGlimpse but whenever I search using it, It
> shows
> > > the source code of the PHP files!
> > > So for example if i search "echo" , WebGlimpse displays the .PHP file
> > source
> > > code!
> > >
> > > Any suggestion for a better site search program?
> > >
> > > -elias
> > >
> > >
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> > >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 





So sprach Siim Einfeldt aka Itpunk am Sat, May 12, 2001 at 07:19:59PM +0200:
> 
> Hi,
> 
> When uploading an .mp3 file, is it possible to check its bit rate with
> php?
> 
> If you know anything about it, please send a mail to my private email as
> well.

Hm, you might try executing mp3info (if it's installed) after the file has
been uploaded, and parsing it's output.

Alexander Skwar
-- 
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:       http://www.digitalprojects.com   |   http://www.iso-top.de
   iso-top.de - Die günstige Art an Linux Distributionen zu kommen
                Uptime: 3 days 4 hours 45 minutes




Hey all,

I am quite horrible when it comes to regexps, but I have a string that
contains a complete url, like:
http://www.domain.com/this/is/it.html

And I need to strip everything but the domain so that I am left with:
www.domain.com

Can anyone help me out?

- John Vanderbeck
- Admin, GameDesign (http://gamedesign.incagold.com/)
- GameDesign, the industry source for game design and development issues






In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] ("John Vanderbeck") wrote:

> I am quite horrible when it comes to regexps, but I have a string that
> contains a complete url, like:
> http://www.domain.com/this/is/it.html
> 
> And I need to strip everything but the domain so that I am left with:
> www.domain.com

Relax, you don't need a regex.  See <http://php.net/parse_url>

-- 
CC




http://www.php.net/manual/en/function.parse-url.php


On Sat, 12 May 2001, John Vanderbeck wrote:

> Hey all,
> 
> I am quite horrible when it comes to regexps, but I have a string that
> contains a complete url, like:
> http://www.domain.com/this/is/it.html
> 
> And I need to strip everything but the domain so that I am left with:
> www.domain.com
> 
> Can anyone help me out?
> 
> - John Vanderbeck






Hi guys!! mine is PHPEd.. =)

Jithy


-----Original Message-----
From: Ryan W. Zajicek [mailto:[EMAIL PROTECTED]]
Sent: Sunday, May 13, 2001 3:58 AM
To: Altunergil, Oktay; [EMAIL PROTECTED]; PHP
Subject: RE: [PHP] PHP Editor


My personal favorite is Ultra Edit (www.ultraedit.com).

Thank You

Ryan
mailto:[EMAIL PROTECTED]

-----Original Message-----
From: Altunergil, Oktay [mailto:[EMAIL PROTECTED]]
Sent: Saturday, May 12, 2001 1:42 PM
To: '[EMAIL PROTECTED]'; PHP
Subject: RE: [PHP] PHP Editor


There's no extended replace in textpad.. More specifically you can't do
extended replace if the files are not all Open.

On the other hand there's no , parantheses, bracket maching in HomeSite.

I still use HomeSite though :)


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Saturday, May 12, 2001 2:40 PM
To: PHP
Subject: Re: [PHP] PHP Editor


I use textpad. http://www.textpad.com. You can arrange your own coloring
config
and there are some very cool elements about it.... there are even modules to
load into it for added functionality....

once you use it you will never go back..mmuuwwahahahaha


----- Original Message -----
From: "Laurie Landry" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Saturday, May 12, 2001 9:24 AM
Subject: RE: [PHP] PHP Editor


I like using Homesite - color coordination of code as well. I use
Dreamweaver for the design elements as well, but sometimes it doesn't work
very well for php coding.

Laurie M. Landry
<lmlweb> Design & Development

www.lmlweb.com
[EMAIL PROTECTED]

T: (604) 872-6915
F: (425) 732-1547

> -----Original Message-----
> From: Dave Mateer [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 11, 2001 2:36 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] PHP Editor
>
>
> I'm using ColdFusion Studio which makes life very easy - good colour
> co-ordination of the code, and only takes 1 button the do an FTP upload up
> to the web-server (I'm using a Windows box to do editing, then a Linux box
> as webserver).
>
> We've been using Dreamweaver as well to bring the design elements
> together...works well, when you're doing the html stuff.  For
> pure coding, I
> recommend ColdFusion Studio.  ahhh it costs money though.
>
> Textpad (from textpad.com) is good...can d/load an evaluation copy (fully
> functional, and doesn't time out)..
>
> Hope this help
>
> David.
>
>
>
> "Daniel" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi,
> >
> > Just wondering whether you guys use any type of editor when
> programming in
> > PHP? if so what have you found to be useful?
> >
> >
> > Thanks
> >
> >
> > Daniel
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
>


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com





Hi, I would like to check whether a variable, $type, is equal to a
number of different possible states. I know I could use
if ( $type == "abc" || $type == "bcd") { $a = b }
but this would get a bit clumsy if I had to check whether it is say
one of 20 different things.

What I was wondering is, is there a better way of doing this? I will
occasionally need to add another option as well, although I don't mind
a simple code edit.


Cheers for your help,  Donald
__________________________________________
As well as learning more,
I learn that there is even more I don't know

http://www.donaldrnoble.f2s.com
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ






How about a case-swtich?
http://www.php.net/manual/en/control-structures.switch.php

Ethan Schroeder
----- Original Message -----
From: "DRN" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, May 12, 2001 4:40 PM
Subject: [PHP] check if a variable is in a number of states.


> Hi, I would like to check whether a variable, $type, is equal to a
> number of different possible states. I know I could use
> if ( $type == "abc" || $type == "bcd") { $a = b }
> but this would get a bit clumsy if I had to check whether it is say
> one of 20 different things.
>
> What I was wondering is, is there a better way of doing this? I will
> occasionally need to add another option as well, although I don't mind
> a simple code edit.
>
>
> Cheers for your help,  Donald
> __________________________________________
> As well as learning more,
> I learn that there is even more I don't know
>
> http://www.donaldrnoble.f2s.com
> ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Here's an appropriate example, one of a few ways you may do it :

 $state  = 'Wa';

 $state  = trim(strtoupper($state));
 $states = array('WA' => 'Washington', 'OR' => 'Oregon', 'ID' => 'Idaho');
  
  if (in_array($state, array_keys($states))) {

    echo "you chose <b>{$states[$state]}</b>, a state in the pacific NW!";

  } else {

    echo "you've chosen <b>$state</b>, an inferior state indeed.";
  }

In the above, we make sure the chosen state is a $states key/index as
array_keys creates an array of keys, from the $states array, like so :

  $keys = array('WA','OR','ID');

If $state is in this array, bingo!  That's one way, it all depends on what
you're doing exactly.  in_array() is a nice little function btw, that's
the point of this post :)  Check out array_keys and array_search too.

regards,
philip


On Sun, 13 May 2001, DRN wrote:

> Hi, I would like to check whether a variable, $type, is equal to a
> number of different possible states. I know I could use
> if ( $type == "abc" || $type == "bcd") { $a = b }
> but this would get a bit clumsy if I had to check whether it is say
> one of 20 different things.
> 
> What I was wondering is, is there a better way of doing this? I will
> occasionally need to add another option as well, although I don't mind
> a simple code edit.
> 
> 
> Cheers for your help,  Donald
> __________________________________________
> As well as learning more,
> I learn that there is even more I don't know
> 
> http://www.donaldrnoble.f2s.com
> ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 





You could also try using a regular expression to get out whatever you need
(if it's a string).  Something like the following:

preg_match_all("/[abc|def|ghi]/",$type, $matches);

- Steve

""DRN"" <[EMAIL PROTECTED]> wrote in message
9dkhdr$nog$[EMAIL PROTECTED]">news:9dkhdr$nog$[EMAIL PROTECTED]...
> Hi, I would like to check whether a variable, $type, is equal to a
> number of different possible states. I know I could use
> if ( $type == "abc" || $type == "bcd") { $a = b }
> but this would get a bit clumsy if I had to check whether it is say
> one of 20 different things.
>
> What I was wondering is, is there a better way of doing this? I will
> occasionally need to add another option as well, although I don't mind
> a simple code edit.
>
>
> Cheers for your help,  Donald
> __________________________________________
> As well as learning more,
> I learn that there is even more I don't know
>
> http://www.donaldrnoble.f2s.com
> ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






"Overusing OO features: PHP is not an object oriented language, while it
does provide object oriented features, you should always be conscious of the
fact that using PHP's object oriented features will significantly slow down
your code."

- a quote taken from Sterling Hughes' "top 21 PHP programming mistakes"
listed on the Zend homepage.

How true is this?

I've been coding in PHP for years now and have almost always written
software in the same general way..My code is *totally* object oriented. I
have individual classes for individual modules(parts of the application) --
everything is in a class.. I've never really noticed a problem with PHP's
execution speed but then I write applications in PHP, not just dynamic web
sites so the things I write rarely get a whole lot of traffic (most apps are
intranet apps and are not available to everyone on the net)..

So... Is this a bad way of doing things in PHP? Exactly what is
"significant" slow down that Mr. Hughes talks about and does anyone have any
real-world examples that might back up what he says? I am in the process of
writing some benchmarks but would still be interested in any and all other
data from other sources...

Thanks!!

-Mitch










On Sat, 12 May 2001, Mitch Vincent wrote:

We too have been developing using an OO approach for awhile - definitely
in PHP4.  One of the other guys here was more OO than I was in PHP3, but
we've standardized more on our coding style in PHP4.

I would not doubt that there's some overhead with an OO approach.  Enough
to make a significant slow down?  We run a moderately high volume site -
the code base is pretty OO when it's called for, and we've not noticed any
significant speed issue.  Something going from 20ms to 40ms or 50ms might
be a 100% or greater speed decrease, but it's still pretty darn small.  

If the OO approach lets you code significantly faster than you would
otherwise be able to, continue to do so.  If speed is an ultimate factor,
and you don't use OO in PHP, don't start.  (Code in assembly or C if speed
is a necessity.)

The real-world small penalty you may pay in OO execution time might more
than be overcome by getting a project done days or weeks quicker than you
would otherwise have been able to.  

> 
> I've been coding in PHP for years now and have almost always written
> software in the same general way..My code is *totally* object oriented. I
> have individual classes for individual modules(parts of the application) --
> everything is in a class.. I've never really noticed a problem with PHP's
> execution speed but then I write applications in PHP, not just dynamic web
> sites so the things I write rarely get a whole lot of traffic (most apps are
> intranet apps and are not available to everyone on the net)..
> 
> So... Is this a bad way of doing things in PHP? Exactly what is
> "significant" slow down that Mr. Hughes talks about and does anyone have any
> real-world examples that might back up what he says? I am in the process of
> writing some benchmarks but would still be interested in any and all other
> data from other sources...
> 
> Thanks!!
> 
> -Mitch





His series of articles ("top php programming mistakes") is great, and
I've heard good things about his "PHP Cookbook" but Hughes is way off
here.  There is some additional overhead with OO code but there is *very*
little difference in speed (less than 5% in synthetic benchmarks, and
much less in more complex php code) - certainly not the "signigicant slow
down" that he claims.

IIRC, later in the article series, Hughes admits he isn't an OO fan, so
he's probably a bit biased.  Maybe he knows of some case where OO PHP code
runs really slow, but since he doesn't present any data to back up his
claims I suspect he just guessed that OO PHP would be slow (ie - he made
it up!).

I don't use OO for everything I do, but if the project is going to be over
1000 lines or so, I find OO code easier to maintain. YMMV.

For testing, I used two simple test files that both printed "hello
world" five times.  I did the benchmarking with ab (apache
bench).  The OO one:

<?php
class bench {
        function test () {
                print "hello world!";
        }
}

$bo = new bench;

$bo->test();
$bo->test();
$bo->test();
$bo->test();
$bo->test();
?>

The non-OO version is the same, but without the class stuff.  The non-OO
version averaged 580 req/s, while the OO version averaged 550 req/s.  This
was on a 600mhz pIII with 256megs of ram running Apache 1.3.19 and PHP
4.0.5 on a Linux 2.4.3 kernel.


Regards,

Sean





Thanks for the help, but the example given does nothing at all.

It has me stumped.

I got my first example working up to the point where you enter the password
but it is not storing the passwords.

Bummer.


"barce" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> ERRATA to the PREVIOUS E-MAIL:
>
> the following line:
> > pass: &nbsp;&nbsp; <input type=password name=user><br>
>
> should read:
>
> pass: &nbsp;&nbsp; <input type=password name=pass><br>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






I am new to PHP having converted from ASP (don't beat me up, it just took me
a while to see the light)

MY QUESTION: What in PHP acts like the 'server.mappath' function in ASP? It
gives you the ability to determain the root of the web site and use it as a
reference.

MY PROBLEM: I have been able to use '/some/folder/whatever.gif' to point to
the image folder with GIFs inside no matter where I am in the site in the
HTML part of my pages. It doesn't seem to work includes in the <?PHP  ?>
tags. I either have to use
'http://www.mysite.com/some/folder/whatever.inc' -OR- '../../whatever.inc'.
Any ideas?

INFO: I am running Apache with PHP4.03 installed as a module

Thanx in advance!!






I have installed CPDF lib instead. Installation was a breeze. I didn't want
to break my RAQ4 with too many config options when it's running live sites.
PDFLib and CPDF carry almost the same type of licenses.

----- Original Message -----
From: "Steve Werby" <[EMAIL PROTECTED]>
To: "Herman Tolentino" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, May 09, 2001 7:17 PM
Subject: Re: [PHP] cobalt raq4


> "Herman Tolentino" <[EMAIL PROTECTED]> wrote:
> > anybody out there who has successfully compiled php (apache module) with
> > PDFLib 4? Much help would be appreciated. Been trying for 1 week.
>
> I haven't tried PDF 4, but I installed PDF 3.03 and compiled PHP with PDF
> support on a RaQ2 recently.  I noticed you're installing on a RaQ4 and
since
> I did so on a RaQ2 with PHP4.0.5 compiled into Apache 1.3.19 binary that
> version of PDF should work on the RaQ4 (x86 is much easier to install on
> than mips platform).  I believe the configuration command I used for
pdflib
> was ./configure  --enable-shared --enable-shared-pdflib
> and --with-pdflib=/usr/local in PHP.  I couldn't tell you whether a newer
> version of PDF will work.  Perhaps if you post your installation steps and
> what errors were encountered someone can help.  BTW, there's a test
> directory in the PDF source and a test script ./pdftest that creates a
test
> PDF file.  Can you get the test file to work?
>
> --
> Steve Werby
> President, Befriend Internet Services LLC
> http://www.befriend.com/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>





Someone on the list mentioned a way to check if a classed is already
declared so it will only declare it once. I can't find it in the
archives so if someone knows how to accomplish this I would appreciate
it if you send me the code.

Thanks in advance.
-- 
************************************
Ivan R. Quintero E.* (507)228-3477      
Aptdo 1263         * (507)228-9105
Balboa, Ancon      * 612-1103
Republic of Panama * 
************************************




class_exists()

--zak

----- Original Message ----- 
From: "rodrigo" <[EMAIL PROTECTED]>
To: "php php" <[EMAIL PROTECTED]>
Sent: Saturday, May 12, 2001 7:56 PM
Subject: [PHP] Making sure a class is declared only once


> Someone on the list mentioned a way to check if a classed is already
> declared so it will only declare it once. I can't find it in the
> archives so if someone knows how to accomplish this I would appreciate
> it if you send me the code.
> 
> Thanks in advance.
> -- 
> ************************************
> Ivan R. Quintero E.* (507)228-3477 
> Aptdo 1263    * (507)228-9105
> Balboa, Ancon    * 612-1103
> Republic of Panama * 
> ************************************
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 





In my Index.html, what do I write so that the Surfer goes to my
Start.Php?

Todd

--
Todd Cary
Ariste Software
[EMAIL PROTECTED]






Todd Cary wrote:

> In my Index.html, what do I write so that the Surfer goes to my
> Start.Php?

It should work to have this after your opening HTML tag in index.html:

<meta http-equiv="refresh" content="0; url=start.php" />






I want to do the following:

1/ open a file via a web page
        A/ Parse out the function names in a class
        B/ Parse out some strings between two 'template block' like markers
        C/ return the names/strings as pull down menus
2/ run a web application to modify the calling sequence of the functions
        in the class via some input selection by the user.
3/ copy the original version to: 
        <original_file_name.php.old.highest_num_ext_found+1> i.e.

        exists: <file_name.php> AND <file_name.php.old.12> 
        copy:   <file_name.php> AS <file_name.php.old.13>
        modify: <file_name.php>

3/ rewrite the section between the 'template block' like markers in
        <file_name.php> with input from user.

My guesses are that:

1/ The new file created by the webserver will only have permissions
        for the webserver/webserver-group access. **I** won't be able
        to access it.
2/ I have to temporarily change the permissions of the file to modify to
        <all> write so that the web server can access it.

Any one have suggestions on how to do this in the script and retain
permissions on
        the new created file?
-- 
-----------------------------------------------------------------
Look lovingly upon the present,
for it holds the only things that are forever true.
-----------------------------------------------------------------
                                Sincerely, Dennis Gearon (Kegley)




Hello all,

My apologies if this is has been answered before or if this is considered
beginner material...but I am trying to make something of a linked list using
PHP.  However, with the absence of pointers, I'm wondering if references
will do the trick.  For example:

/////////////////////////////////////////////////////////////////////////
class node
{
    var value;
    var child;
    var parent;
}

$top = new node();
$top->value = "hello";

$test = new node();
$top->child = &$test;
$test->parent = &$top;
/////////////////////////////////////////////////////////////////////////

Has anyone attempted anything like this before or can anyone think of a
reason that this will not work?  Thank you!

- Steve






Does anyone know what the sequence argument is suppose to be? More
importantly, what the numbers stand for "2,4:6"?

Chris






hi all,

On one of my sites we make extensive use of variable passed through the
url, particullarly for browsing the main content of the site which is
organised into main and sub categories, eg
browse.php?maincat=Weather&subcat=sunny kind of thing.

I understand from colleagues who know much on these things that public
search engines bots (eg google) stop parsing thru that part of the site
when they reach a '?' (I could well be wrong on this).

a way around this that I have heard is installing the mod_rewrite module
in apache and mapping browse/weather/sunny to
browse.php?maincat=weather&subcat=sunny.

Would this in fact even  fix the problem? Its a hard thing to test!

Does anyone have any experience using this? And what is the advice from
people on how best to get google&co to spider your site and find your
content effectively?

Thanks in advance

Tom



Reply via email to