php-general Digest 19 Nov 2004 09:41:35 -0000 Issue 3121
Topics (messages 202469 through 202492):
Re: PHP Supremacy...
202469 by: Mike
Re: [OOP] Class to handle PEAR::DB
202470 by: valerie17.telkom.net
Re: $_FILES and move_uploaded_file showed no directories name???
202471 by: Scott Fletcher
202473 by: Richard Davey
Re: PHP Supremacy...]
202472 by: Peter Risdon
Understanding Static Methods
202474 by: Jordi Canals
202475 by: Sylvain Girard
access the under hood dom object from c code inside php-extension
202476 by: luise.hans
Re: Sequrity without HTTPS?
202477 by: Chris Shiflett
202478 by: Chris Shiflett
202480 by: Ramil Sagum
Re: php/html displaying query
202479 by: David Robley
Re: Is Perl faster than PHP?
202481 by: Chris Shiflett
202484 by: Mulley, Nikhil
PEAR::SOAP <return> tag trouble in migration to PEAR::SOAP from NuSOAP
202482 by: Jeff Rodriguez
Re: PHP-editor connected to FTP?
202483 by: Chris
I am new - Having problems displaying something
202485 by: Brian Heibert
202486 by: Warren Vail
getting the highest number in 3 db fields?
202487 by: Louie Miranda
202488 by: Dennis Seavers
202489 by: Louie Miranda
Confused with constructors
202490 by: Gerald Wharney
202491 by: Gareth Williams
Simple coding question
202492 by: Octavian Rasnita
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]
----------------------------------------------------------------------
--- Begin Message ---
[snip]
There's a Netcraft survey based graph at php.net that shows about 17
million PHP-powered sites. And we don't need to make assumptions about
ASP either: PHP overtook classic in 2002 and ASP.Net powers fewer than 3
million sites.
[\snip]
Also remember that all you need to dev PHP is a text editor. I still do a
lot of editing in notepad and wordpad.
When you start doing .Net applications you need to get visual studio - which
is far from inexpensive.
PHP will be around for a LONG time because it's accessible. So many people
can use it and it easily crosses from dev to live environments - some of
which on different platforms.
So all the numbers aside, PHP will survive because so many people have the
ability to use it for whatever they can think of in virtually whatever task
they need it to fulfill. The PHP community isn't just a group of hardcore
advocates.
Hang around the boards for a few weeks and see how many people are first
time posters. The number is growing and doesn't take into account the people
that never make it here.
--- End Message ---
--- Begin Message ---
object(DBku)#1 (6) { ["type"]=> string(5) "mysql" ["user"]=> string(4)
"root" ["pass"]=> string(0) "" ["host"]=> string(9) "localhost" ["db"]=>
string(7) "valerie" ["dbhandler"]=> NULL } Standard Message: DB Error: no
database selected Standard Code: -14 DBMS/User Message: SELECT * FROM
country [nativecode=1046 ** No Database Selected] DBMS/Debug Message: SELECT
* FROM country [nativecode=1046 ** No Database Selected]
of course it would return the same otherwise it'll have no <BR> via web
browser . And yes, my previous projects worked very well and I do have MySql
support for my PHP 5.0.1. Isn't it strange ? Or it's just the logic of my
OOP code go wrong ?
Valérie Delon
étudiante
--
On a besoin d'apprendre beacoup plus
Quelqu'un croit c'est trop
Mais j'crois que ce n'est pas assez
From: Jason Wong <[EMAIL PROTECTED]>
Date: Thu, 18 Nov 2004 19:06:56 +0800
Subject: Re: [PHP] [OOP] Class to handle PEAR::DB
On Thursday 18 November 2004 17:05, [EMAIL PROTECTED] wrote:
> my problem is : everytime I execute this file in CLI mode I always got
this
[...]
> Standard Message: DB Error: no database selected
> Standard Code: -14
> DBMS/User Message: SELECT * FROM country [nativecode=1046 ** No Database
> Selected]
> DBMS/Debug Message: SELECT * FROM country [nativecode=1046 ** No Database
> Selected]
>
> How come the message said I didn't select database ??
Does this work when executed via a webserver? If so, have you checked that
you
have MySQL support compiled into your CLI php?
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
"For a moment, nothing happened. Then, after a second or
so, nothing continued to happen. "
*/
--- End Message ---
--- Begin Message ---
Yep, that Java applet, Raditha's Rad Upload... Just found the documentation
there that the file path worked before PHP 4.3.6 but not with 4.3.6 and up.
I don't know what the PHP developer did with the $_FILE codes before
releasing PHP 4.3.6....
Scott
"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Jason Wong wrote:
> > On Friday 19 November 2004 03:28, Scott Fletcher wrote:
> >
> >>Well, I had successfully uploaded the files/folders. PHP just stripped
out
> >>the folders for no reasons. A file can be a folder too.
> >
> >
> > Could you explain how you did that (upload a folder)?
> >
>
> I guess using Raditha's Rad Upload.
--- End Message ---
--- Begin Message ---
Hello Scott,
Thursday, November 18, 2004, 7:28:00 PM, you wrote:
SF> Well, I had successfully uploaded the files/folders. PHP just
SF> stripped out the folders for no reasons. A file can be a folder
SF> too.
If you insist.
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I am not young enough to know everything." - Oscar Wilde
--- End Message ---
--- Begin Message ---
Whoops, didn't include the list.
--
the circle squared
network systems and software
http://www.circlesquared.com
--- Begin Message ---
Pedro Irán Méndez Pérez wrote:
Hello my friends, I need your help in convince to my boss in adopt php for
development of a tool for intranet in my office, he told me that php is open
source and we don´t know if will disappear in a year, or if php have a
support like .net.
what arguments can I show for convince him to try PHP?
Maybe point out to your manager that the internet is, essentially, open
source software. That, as others have pointed out, the whole essence of
Open Source is that it can't disappear. This is a question to be asked
about proprietary software, not open source.
The biggest problem might be tact: he's not being terribly bright.
Regards,
Peter.
--
the circle squared
network systems and software
http://www.circlesquared.com
--- End Message ---
--- End Message ---
--- Begin Message ---
Hi all,
I'm trying to understand static methods in a test class. Reading the
manual, it says: "A member or method declared with static can not be
accessed with a variable that is an instance of the object and cannot
be re-defined in an extending class."
Test code:
========
<?php
class B
{
private $str;
public final function __construct()
{
$this->str = 'Hello world';
}
public function showB()
{
echo $this->str, '<br>';
echo 'Showing B<br>';
$this->TestStatic();
}
public static function TestStatic()
{
echo '<br>Inside Static<br>';
}
}
echo error_reporting() . '<br>';
$test = new B;
$test->TestStatic();
$test->showB();
echo "-- END --";
?>
Output:
=====
4095
Inside Static --> Called by $test->TestStatic()
Hello world
Showing B
Inside Static --> Called from $test->showB with $this->TestStatic()
-- END --
Comments:
========
I'm running PHP 5.0.2 and error_reporting = E_ALL | E_STRICT. As
reported in the output, the values for error_reporting are well set
(4095 == E_ALL | E_STRICT)
I cannot understand why I can access the method TestStatic() with a
variable that is an instance of the class. The manual say I cannot do
it. As you can see, I call the static method with $this->TestStatic()
inside the showB() method; also, I can access it by using the instance
of this class: test->TestStatic().
I get no errors or notices about I'm accessing an static method by
using and instance var. As you can read in the manual, you cannot do
that .... but it works without error.
I'm sure I'm missing something ...
Thanks in advance for comments,
Jordi.
--- End Message ---
--- Begin Message ---
I'm taking a wild guess here, but doesn't that got anything to do with the
public declaration of the method?
-----Oorspronkelijk bericht-----
Van: Jordi Canals [mailto:[EMAIL PROTECTED]
Verzonden: vrijdag 19 november 2004 2:29
Aan: PHP List
Onderwerp: [PHP] Understanding Static Methods
Hi all,
I'm trying to understand static methods in a test class. Reading the
manual, it says: "A member or method declared with static can not be
accessed with a variable that is an instance of the object and cannot
be re-defined in an extending class."
Test code:
========
<?php
class B
{
private $str;
public final function __construct()
{
$this->str = 'Hello world';
}
public function showB()
{
echo $this->str, '<br>';
echo 'Showing B<br>';
$this->TestStatic();
}
public static function TestStatic()
{
echo '<br>Inside Static<br>';
}
}
echo error_reporting() . '<br>';
$test = new B;
$test->TestStatic();
$test->showB();
echo "-- END --";
?>
Output:
=====
4095
Inside Static --> Called by $test->TestStatic()
Hello world
Showing B
Inside Static --> Called from $test->showB with
$this->TestStatic()
-- END --
Comments:
========
I'm running PHP 5.0.2 and error_reporting = E_ALL | E_STRICT. As
reported in the output, the values for error_reporting are well set
(4095 == E_ALL | E_STRICT)
I cannot understand why I can access the method TestStatic() with a
variable that is an instance of the class. The manual say I cannot do
it. As you can see, I call the static method with $this->TestStatic()
inside the showB() method; also, I can access it by using the instance
of this class: test->TestStatic().
I get no errors or notices about I'm accessing an static method by
using and instance var. As you can read in the manual, you cannot do
that .... but it works without error.
I'm sure I'm missing something ...
Thanks in advance for comments,
Jordi.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Is there any way/document/direction to access the under hood dom object
which is created in php land from the c code inside php extensions?
something like this:
in the php code, I do:
$domdoc = new DOMDocument;
$domdoc->loadXML($strXMLData);
$domnode = $domdoc->firstChild;
//... some operations on dom, then I will call
func_implemented_in_php_extension($domdoc);
and in the c land of php extension, can i do:
PHP_MINIT_FUNCTION(func_implemented_in_php_extension)
{
//...
if (zend_parse_parameters(argc TSRMLS_CC, "z", &domdoc, &dom_len)
==FAILURE)
//...and I can continue to manipulete the dom object in c api, like
domnode = domdoc->firstChild();
domnode->set_content("hello world");
}
and later back to my php code, I do
print($domdoc->firstchild->get_content());
and the out put is "hello world".
On other hand, any idea to do this in the reversed way, access
underhood dom object which is created in c land of php extension from
the php code?
Thanks!
Luise
--- End Message ---
--- Begin Message ---
--- Peter Lauri <[EMAIL PROTECTED]> wrote:
> Can someone from outside set a $_SESSION variable with some
> "hacker" techniqe?
For all practical purposes, no. Session data is kept on the server and
therefore less exposed and less vulnerable than other data.
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming February 2005 http://httphandbook.org/
--- End Message ---
--- Begin Message ---
--- Peter Lauri <[EMAIL PROTECTED]> wrote:
> If you use the Autority HTTP that pops up a login window by
> default, is that safe against "listeners"?
Assuming you mean HTTP Basic Authentication, it is not encrypted, so it is
not "safe" from snooping.
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming February 2005 http://httphandbook.org/
--- End Message ---
--- Begin Message ---
On Thu, 18 Nov 2004 12:41:01 +0100, Peter Lauri <[EMAIL PROTECTED]> wrote:
> Best groupmember,
>
> My webhost (crappy
> but nonexpensive) does not support HTTPS and I still want to be able to
> create some sort of secure login.
>
> Someone with some tips and tricks to get a secure system without using
> HTTPS?
>
>
Not really that secure, but you could do this
1. When the login page is requested, the generate a random string
from the server. Let's call this string STR.
2. On the browser, after the user enters his login name and password,
DONT send this per se. Instead, do some operation on the password and
STR and return this instead. (like concatenate STR and password, then
do SHA1 hash it.)
3. Server performs the same operation with STR and the password in
the database, and compares this with the value submitted from the
client.
So, in no time is the password itself sent. I'm sure there are SHA1
or at least MD5 functions already written in javascript.
I know there is a term to this method, but it escapes me.
HTH!
----
ramil
http://ramil.sagum.net
--- End Message ---
--- Begin Message ---
On Fri, 19 Nov 2004 00:44, Angelo Zanetti wrote:
> HI all,
>
> I have this situation & think that maybe some of you could advise me on
> a solution.
>
> I have a field in my database which is about a few paragraphs long.
> When the user edits this paragraph using php/html in a textarea it
> displays correctly with the lines that separate the paragraphs. These
> lines are merely blank lines.
>
> However when I want to display this field in HTML I have a problem that
> its all bunched into 1 paragraph, obviously because there are no <p> or
> <br> tags telling the browser there is a space in between, 1 way to get
> this to work is to to insert <p> or <br> statements in the paragraph but
> when the user then edits the paragraph in the textarea it will show the
> <p> or <br> tags which i dont want, they are end users and will probably
> delete them. Is there a way to get around this?? either displaying the
> blank line or by hiding the HTML tags in the textarea (but still saving
> the paragraph with them in)
Use nl2br() when you display the data; nl2br will add a <BR /> before each
newline.
--
David Robley
"I hope I can still play the guitar," Tom fretted.
--- End Message ---
--- Begin Message ---
--- Merlin <[EMAIL PROTECTED]> wrote:
> it came to my attention that most of the high traffic portals
> are using perl in the backend. Those sites do also apear to me
> to be very fast in comparison to most php sites. Are there any
> known performance comperissons between the two available? Or can
> one say that PHP or Perl is faster about x percent in general
> compared to the other one?
PHP and Perl are both key tools used to build many of the Web's top sites
- Amazon, Yahoo, Ticketmaster, Google, etc. As a Perl developer worded it
at this past week's ApacheCon, these types of sites "receive an obscene
amount of traffic."
How these two languages perform and scale relative to one another is
entirely dependent on the design and implementation - neither is going to
consistently be better than the other, but both are very good.
You will notice that the top sites don't use Java or .NET. :-)
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming February 2005 http://httphandbook.org/
--- End Message ---
--- Begin Message ---
It all depends on the factors like Computer Hardware, Optimization of PHP for
that System/OS , Network Factors and all .
Though it has been the perl way , as it is almost more than a teenager of age
now and has more modules written for it than for PHP , PHP is the beggining ,
but I am sure the Programmers around the world ,who code for PHP way , thier
hardwork will not go waste. and also Shifflet , I know you are the one among ,
PHP is easier to code than Perl .
Yeah , its true that top sites do not use Java or >NET ,
-----Original Message-----
From: Chris Shiflett [mailto:[EMAIL PROTECTED]
Sent: Friday, November 19, 2004 8:44 AM
To: Merlin; [EMAIL PROTECTED]
Subject: Re: [PHP] Is Perl faster than PHP?
--- Merlin <[EMAIL PROTECTED]> wrote:
> it came to my attention that most of the high traffic portals
> are using perl in the backend. Those sites do also apear to me
> to be very fast in comparison to most php sites. Are there any
> known performance comperissons between the two available? Or can
> one say that PHP or Perl is faster about x percent in general
> compared to the other one?
PHP and Perl are both key tools used to build many of the Web's top sites
- Amazon, Yahoo, Ticketmaster, Google, etc. As a Perl developer worded it
at this past week's ApacheCon, these types of sites "receive an obscene
amount of traffic."
How these two languages perform and scale relative to one another is
entirely dependent on the design and implementation - neither is going to
consistently be better than the other, but both are very good.
You will notice that the top sites don't use Java or .NET. :-)
Chris
=====
Chris Shiflett - http://shiflett.org/
PHP Security - O'Reilly HTTP Developer's Handbook - Sams
Coming February 2005 http://httphandbook.org/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I'm trying to migrate to PEAR::SOAP from NuSOAP, but I'm confused as to
why the result sent back from a function is wrapped in a <return> tag.
The return part of my code is simple enough:
return array('lastStatus' => 'ok');
But this gets wrapped in a <return> tag:
<return xsi:type="xsd:string">
<lastStatus
xsi:type="xsd:string">ok</lastStatus></return></ns4:reportInResponse>
Here is the SOAP response:
<SOAP-ENV:Envelope
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:ns4="urn:mwsWSDL"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns4:reportInResponse>
<return xsi:type="xsd:string">
<lastStatus
xsi:type="xsd:string">ok</lastStatus></return></ns4:reportInResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
--
Jeffrey Alan Rodriguez
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
On Thu, 18 Nov 2004 09:35:42 -0800, Chris W. Parker <[EMAIL PROTECTED]>
wrote:
Peter Lauri <mailto:[EMAIL PROTECTED]>
on Thursday, November 18, 2004 12:42 AM said:
What editor do you use when working with websites (php) connected
directly to the FTP?
I like Eclipse 3.0 with the PHP plugin, but it do not have the future
to connect to the FTP.
HTML-Kit (www.chami.com) will do this. I've been using HTML-Kit for
almost 2 years and I've never had a problem with a bad save.
hth,
chris.
I use HTML-Kit as well and feel it is a bloated pile of crap. Tab
handling is broken (if you select "tabs" over "spaces", selected text will
still indent with spaces if you press tab to indent the whole block of
code). It suffers from severe option overload. It lacks the ability to
use secure FTP. It also lacks simple features like setting a block of
selected text to all lowercase without a plugin.
The only feature I actually like is the ability to edit files via FTP so
that when I hit save, it uploads the new copy to the server. So if that's
all you really care about in an editor, HTML-Kit will do a fine job.
Also, if you tell it where PHP is found on your local machine, it will
highlight all of the PHP function names.
I have tried Ultra Edit, which claims to have a similar feature and
supports secure FTP, but has a horrible implementation compared to
HTML-Kit. EditPlus claims it can connect via secure FTP through an SSH
tunnel, which simply does not work if the server it is connecting to does
not allow FTP connections at all.
--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
--- End Message ---
--- Begin Message ---
Hi,
I am new to this list. I am trying to do a php script that will say what
song is currently playing in iTunes/NiceCast Internet Radio broadcaster
Onto my website
Every attempt I have made so far has failed
I got a file called playing.php
With this text inside it:
<?php
echo "Current Song: ".passthru("osascript
/Library/WebServer/Documents/christiantoplist/whattrack.scpt");
?>
And a file called whattrack.scpt (AppleScript file) with this in it
tell application "iTunes"
set trk to current track
set tle to name of trk
set art to artist of trk
set albm to album of trk
return tle & " - " & art & ", " & albm
end tell
But it is not displaying what song is playing on my website
All it says is Current Song: and then it doesn't say the song
Brian Heibert
PS: I have a iMac G4 800mhz OS 10.3.6 running Apple's webserver system
preference which is there version of Apache I think
--- End Message ---
--- Begin Message ---
Looks like the URL you are trying to passthru is missing a domain, No? ;-)
Warren Vail
> -----Original Message-----
> From: Brian Heibert [mailto:[EMAIL PROTECTED]
> Sent: Thursday, November 18, 2004 9:33 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] I am new - Having problems displaying something
>
>
> Hi,
>
> I am new to this list. I am trying to do a php script that will say what
> song is currently playing in iTunes/NiceCast Internet Radio broadcaster
> Onto my website
>
> Every attempt I have made so far has failed
>
> I got a file called playing.php
> With this text inside it:
> <?php
>
> echo "Current Song: ".passthru("osascript
> /Library/WebServer/Documents/christiantoplist/whattrack.scpt");
>
> ?>
>
>
> And a file called whattrack.scpt (AppleScript file) with this in it
> tell application "iTunes"
> set trk to current track
> set tle to name of trk
> set art to artist of trk
> set albm to album of trk
> return tle & " - " & art & ", " & albm
> end tell
>
> But it is not displaying what song is playing on my website
> All it says is Current Song: and then it doesn't say the song
>
> Brian Heibert
>
> PS: I have a iMac G4 800mhz OS 10.3.6 running Apple's webserver system
> preference which is there version of Apache I think
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
--- End Message ---
--- Begin Message ---
I have a db field of 3.
- prolog
- transmodal
- asian
I wish to get the highest number of those three, in different fields.
Im thingking of..
if (row0 =< row1) ...
how about row2?
confused..
--
Louie Miranda
http://www.axishift.com
--- End Message ---
--- Begin Message ---
Try using the SQL aggregate function MAX() or the PHP function max()
> [Original Message]
> From: Louie Miranda <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Date: 11/18/2004 11:34:57 PM
> Subject: [PHP] getting the highest number in 3 db fields?
>
> I have a db field of 3.
>
> - prolog
> - transmodal
> - asian
>
> I wish to get the highest number of those three, in different fields.
>
> Im thingking of..
>
> if (row0 =< row1) ...
>
> how about row2?
>
> confused..
>
> --
> Louie Miranda
> http://www.axishift.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
thanks, im not aware that php also has max(), ty.
On Thu, 18 Nov 2004 23:46:01 -0700, Dennis Seavers
<[EMAIL PROTECTED]> wrote:
> Try using the SQL aggregate function MAX() or the PHP function max()
>
> > [Original Message]
> > From: Louie Miranda <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Date: 11/18/2004 11:34:57 PM
> > Subject: [PHP] getting the highest number in 3 db fields?
>
>
> >
> > I have a db field of 3.
> >
> > - prolog
> > - transmodal
> > - asian
> >
> > I wish to get the highest number of those three, in different fields.
> >
> > Im thingking of..
> >
> > if (row0 =< row1) ...
> >
> > how about row2?
> >
> > confused..
> >
> > --
> > Louie Miranda
> > http://www.axishift.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Louie Miranda
http://www.axishift.com
--- End Message ---
--- Begin Message ---
I'm trying the example at:
http://www.php.net/manual/en/language.oop.constructor.php
<?php
class A
{
function A()
{
echo "I am the constructor of A.<br />\n";
}
function B()
{
echo "I am a regular function named B in class
A.<br />\n";
echo "I am not a constructor in A.<br />\n";
}
}
class B extends A
{
function C()
{
echo "I am a regular function.<br />\n";
}
}
// This will call B() as a constructor.
$b = new B;
?>
Running this on 4.3.9 both as an apache module and
from CLI I get:
I am a regular function named B in class A.
I am not a constructor in A.
This is contrary to what the manual says:
"This is fixed in PHP 4 by modifying the rule to: 'A
constructor is a function of the same name as the
class it is being defined in.'. Thus in PHP 4, the
class B would have no constructor function of its own
and the constructor of the base class would have been
called, printing 'I am the constructor of A.<br />'."
Is this an error in the manual?
Or a bug in php 4.3.9?
Or just me being stupid?
--
G W (no bush)
___________________________________________________________
ALL-NEW Yahoo! Messenger - all new features - even more fun!
http://uk.messenger.yahoo.com
--- End Message ---
--- Begin Message ---
Try this:
class base_object()
{
function base_object()
{
echo "I'm the base";
}
function base_test()
{
echo "I'm the base test";
}
}
class extended_object() extends base_object
{
function extended_object()
{
echo "I'm the extend object";
$this->base_object();
}
function extended_test()
{
echo "I'm the extended test";
}
}
Barring any syntax errors (I wrote this out of my head), this should
show you that the base object is being properly constructed.
On 19 Nov 2004, at 09:02, Gerald Wharney wrote:
I'm trying the example at:
http://www.php.net/manual/en/language.oop.constructor.php
<?php
class A
{
function A()
{
echo "I am the constructor of A.<br />\n";
}
function B()
{
echo "I am a regular function named B in class
A.<br />\n";
echo "I am not a constructor in A.<br />\n";
}
}
class B extends A
{
function C()
{
echo "I am a regular function.<br />\n";
}
}
// This will call B() as a constructor.
$b = new B;
?>
Running this on 4.3.9 both as an apache module and
from CLI I get:
I am a regular function named B in class A.
I am not a constructor in A.
This is contrary to what the manual says:
"This is fixed in PHP 4 by modifying the rule to: 'A
constructor is a function of the same name as the
class it is being defined in.'. Thus in PHP 4, the
class B would have no constructor function of its own
and the constructor of the base class would have been
called, printing 'I am the constructor of A.<br />'."
Is this an error in the manual?
Or a bug in php 4.3.9?
Or just me being stupid?
--
G W (no bush)
___________________________________________________________
ALL-NEW Yahoo! Messenger - all new features - even more fun!
http://uk.messenger.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi all,
Please tell me which is the shortest method for writing the following code:
$var = $_GET['var'] || 'value';
I want the program to put the value "value" in the variable $var if the
array element 'var' is not defined or in case it is 0 and I would like to
avoid using that long style with if (..) {...} else {...}...
Thank you.
Teddy
--- End Message ---