php-general Digest 1 Sep 2007 17:07:14 -0000 Issue 4994
php-general Digest 1 Sep 2007 17:07:14 - Issue 4994 Topics (messages 261582 through 261595): Re: How to show proper time to users from around the world 261582 by: Hemanth Re: Is a small memory footprint better for a php script? 261583 by: Per Jessen Re: regular expression question 261584 by: Richard Heyes strange reference behavior 261585 by: Robert Enyedi 261586 by: Martin Ellingham 261591 by: Robert Cummings 261592 by: Robert Cummings 261594 by: Robert Enyedi mail() silly question 261587 by: Rodrigo Poblanno Balp 261588 by: Ludovic André 261589 by: chris smith 261593 by: Bastien Koert Re: Which CAPTCHA is the besta? 261590 by: Ronald Wiplinger Re: Best Practices for calling 'setup' classes that extend 'parent' classes? 261595 by: Graham Anderson 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] -- ---BeginMessage--- what is the time shown by gmail with every mail ? ---End Message--- ---BeginMessage--- Mark wrote: Hey, I'm wondering something about memory usage. I just looked at how much memory the newest phpbb is using and that's over 2 mega bytes!! Now i'm working on a php script that is currently using around 600 kilo bytes. The question now is: what is better? a script with a small memory usage? or is that something i don't need to look at? As a rule of thumb, using less resources (memory/disk/cpu) is better. Though depending on your actual situation, it may not be _visibly_ better. (a large machine with a lot of resources can cope with a lot of resource abuse/waste without performance ever suffering). /Per Jessen, Zürich ---End Message--- ---BeginMessage--- But how? The +[a-z]{2,} seems to allow at least two a-z clusters, but it doesn't include a period. /ml Almost correct. The plus belongs to whatever comes before it, not after. So what you're referring to as matching two or more characters but not the period, is this: [a-z]{2,} And this will match one or more subdomains: ([-a-z0-9]+\.)+ -- Richard Heyes +44 (0)800 0213 172 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support ---End Message--- ---BeginMessage--- Hi, I've been studying the PHP reference mechanism (with PHP 5.2.1) and I'm unsure if the following behavior is normal. This code works as expected: $a = 2; $b = $a; //$c = $a; $c = $b; $a = 1; echo $c.\n; // Prints 2 as expected but this one does not: $a = 2; $b = $a; $c = $a; $c = $b; // Should overwrite the previous assignment, so $c // should get a copy of $b (and NOT a reference) $a = 1; echo $c.\n; // I would expect 2, but prints 1 Could anyone please clarify why this happens? Regards, Robert ---End Message--- ---BeginMessage--- Robert Enyedi wrote: Hi, I've been studying the PHP reference mechanism (with PHP 5.2.1) and I'm unsure if the following behavior is normal. This code works as expected: $a = 2; $b = $a; //$c = $a; $c = $b; $a = 1; echo $c.\n; // Prints 2 as expected but this one does not: $a = 2; $b = $a; $c = $a; $c = $b; // Should overwrite the previous assignment, so $c // should get a copy of $b (and NOT a reference) $a = 1; echo $c.\n; // I would expect 2, but prints 1 Could anyone please clarify why this happens? Regards, Robert This is because PHP5 has changed the default behaviour and $a = $b is now call by reference as standard. That's my understanding of it. Martin ---End Message--- ---BeginMessage--- On Sat, 2007-09-01 at 13:06 +0300, Robert Enyedi wrote: Hi, I've been studying the PHP reference mechanism (with PHP 5.2.1) and I'm unsure if the following behavior is normal. This code works as expected: $a = 2; $b = $a; //$c = $a; $c = $b; $a = 1; echo $c.\n; // Prints 2 as expected but this one does not: $a = 2; $b = $a; $c = $a; $c = $b; // Should overwrite the previous assignment, so $c // should get a copy of $b (and NOT a reference) $a = 1; echo $c.\n; // I would expect 2, but prints 1 Could anyone please clarify why this happens? Sure... 1: $a = 2; 2: $b = $a; 3: $c = $a; 4: $c = $b; // Should overwrite the previous assignment, so $c 5:// should get a copy of $b (and NOT a reference) 6: $a = 1; 7: 8: echo $c.\n; // I would expect 2, but prints 1 By line number... 1: Assign 2 to a variable called $a 2: Assign to $b a reference to $a 3: Assign to $c a reference to $a 4: Assign
Fwd: [PHP] How to show proper time to users from around the world
what is the time shown by gmail with every mail ?
Re: [PHP] Is a small memory footprint better for a php script?
Mark wrote: Hey, I'm wondering something about memory usage. I just looked at how much memory the newest phpbb is using and that's over 2 mega bytes!! Now i'm working on a php script that is currently using around 600 kilo bytes. The question now is: what is better? a script with a small memory usage? or is that something i don't need to look at? As a rule of thumb, using less resources (memory/disk/cpu) is better. Though depending on your actual situation, it may not be _visibly_ better. (a large machine with a lot of resources can cope with a lot of resource abuse/waste without performance ever suffering). /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regular expression question
But how? The +[a-z]{2,} seems to allow at least two a-z clusters, but it doesn't include a period. /ml Almost correct. The plus belongs to whatever comes before it, not after. So what you're referring to as matching two or more characters but not the period, is this: [a-z]{2,} And this will match one or more subdomains: ([-a-z0-9]+\.)+ -- Richard Heyes +44 (0)800 0213 172 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strange reference behavior
Hi, I've been studying the PHP reference mechanism (with PHP 5.2.1) and I'm unsure if the following behavior is normal. This code works as expected: $a = 2; $b = $a; //$c = $a; $c = $b; $a = 1; echo $c.\n; // Prints 2 as expected but this one does not: $a = 2; $b = $a; $c = $a; $c = $b; // Should overwrite the previous assignment, so $c // should get a copy of $b (and NOT a reference) $a = 1; echo $c.\n; // I would expect 2, but prints 1 Could anyone please clarify why this happens? Regards, Robert -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strange reference behavior
Robert Enyedi wrote: Hi, I've been studying the PHP reference mechanism (with PHP 5.2.1) and I'm unsure if the following behavior is normal. This code works as expected: $a = 2; $b = $a; //$c = $a; $c = $b; $a = 1; echo $c.\n; // Prints 2 as expected but this one does not: $a = 2; $b = $a; $c = $a; $c = $b; // Should overwrite the previous assignment, so $c // should get a copy of $b (and NOT a reference) $a = 1; echo $c.\n; // I would expect 2, but prints 1 Could anyone please clarify why this happens? Regards, Robert This is because PHP5 has changed the default behaviour and $a = $b is now call by reference as standard. That's my understanding of it. Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail() silly question
I have a question that might be too silly for those of you who are PHP gurus. Here it comes: I had a mail (specifically in the headers) function call like this: $header = ; $header .= 'From: [EMAIL PROTECTED]; $header .= 'MIME-Version: 1.0\r\n; $header .= 'Content-type: text/html; charset=iso-8859-1\r\n; $header .= Reply-To: .utf8_decode($nombreVar). .utf8_decode($apellidosVar).$mailVar\r\n; $header .= X-Mailer: PHP/.phpversion().\r\n; $header .= X-Priority: 1; and the mail(...) function always returned TRUE, but the mail was NOT sent. After hours of... trial/error debugging, I noticed from an example that it should be: $header = ; $header .= 'From: [EMAIL PROTECTED]' . \r\n; $header .= 'MIME-Version: 1.0' . \r\n; $header .= 'Content-type: text/html; charset=iso-8859-1' . \r\n; $header .= Reply-To: .utf8_decode($nombreVar). .utf8_decode($apellidosVar).$mailVar\r\n; $header .= X-Mailer: PHP/.phpversion().\r\n; $header .= X-Priority: 1; Question: Why? What's the real difference between $header .= 'From: [EMAIL PROTECTED]' . \r\n; and $header .= 'From: [EMAIL PROTECTED]; ? If somebody knows, please let me know! Thank you in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() silly question
Hi, Question: Why? What's the real difference between $header .= 'From: [EMAIL PROTECTED]' . \r\n; and $header .= 'From: [EMAIL PROTECTED]; Your second declaration is incorrect: you start with a single quote ('), and you end with a double (). So, you'd say ok, let's fix it: $header .= 'From: [EMAIL PROTECTED]'; BUT, special chars like \n or \r need to be inside a double-quoted string in order to be taken into account. This one is then correct: $header .= 'From: [EMAIL PROTECTED]' . \r\n; This one as well: $header .= From: [EMAIL PROTECTED]; Ludovic André -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() silly question
On 9/1/07, Rodrigo Poblanno Balp [EMAIL PROTECTED] wrote: I have a question that might be too silly for those of you who are PHP gurus. Here it comes: I had a mail (specifically in the headers) function call like this: $header = ; $header .= 'From: [EMAIL PROTECTED]; $header .= 'MIME-Version: 1.0\r\n; $header .= 'Content-type: text/html; charset=iso-8859-1\r\n; $header .= Reply-To: .utf8_decode($nombreVar). .utf8_decode($apellidosVar).$mailVar\r\n; $header .= X-Mailer: PHP/.phpversion().\r\n; $header .= X-Priority: 1; and the mail(...) function always returned TRUE, but the mail was NOT sent. After hours of... trial/error debugging, I noticed from an example that it should be: $header = ; $header .= 'From: [EMAIL PROTECTED]' . \r\n; $header .= 'MIME-Version: 1.0' . \r\n; $header .= 'Content-type: text/html; charset=iso-8859-1' . \r\n; $header .= Reply-To: .utf8_decode($nombreVar). .utf8_decode($apellidosVar).$mailVar\r\n; $header .= X-Mailer: PHP/.phpversion().\r\n; $header .= X-Priority: 1; Question: Why? What's the real difference between $header .= 'From: [EMAIL PROTECTED]' . \r\n; and $header .= 'From: [EMAIL PROTECTED]; Actually that's a parse error ;) You have a single quote at the start and double at the end. Anyway, the reason is interpolation. See http://www.php.net/manual/en/language.types.string.php Under Single quoted: .. escape sequences for special characters will not be expanded when they occur in single quoted strings. So you end up with a literal '\r\n' at the end of the line, not an actual carriage return newline that you expect. -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Which CAPTCHA is the besta?
Hamza Saglam wrote: Not a script you can install/hack but why don't you have a look at: http://recaptcha.net/ ? I am going to try that one. It sounds good and gives me a feeling to do something good to the community as well. Which version have you tried? Java or PHP? How to set-up PHP? Some people say that captcha is just to bother humans, while the robots are learning faster to deal with it! bye Ronald Regards, Hamza. Tony Di Croce [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I need a CAPTCHA script Which one is the best? (I dont mind if its somewhat difficult). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strange reference behavior
On Sat, 2007-09-01 at 13:06 +0300, Robert Enyedi wrote: Hi, I've been studying the PHP reference mechanism (with PHP 5.2.1) and I'm unsure if the following behavior is normal. This code works as expected: $a = 2; $b = $a; //$c = $a; $c = $b; $a = 1; echo $c.\n; // Prints 2 as expected but this one does not: $a = 2; $b = $a; $c = $a; $c = $b; // Should overwrite the previous assignment, so $c // should get a copy of $b (and NOT a reference) $a = 1; echo $c.\n; // I would expect 2, but prints 1 Could anyone please clarify why this happens? Sure... 1: $a = 2; 2: $b = $a; 3: $c = $a; 4: $c = $b; // Should overwrite the previous assignment, so $c 5:// should get a copy of $b (and NOT a reference) 6: $a = 1; 7: 8: echo $c.\n; // I would expect 2, but prints 1 By line number... 1: Assign 2 to a variable called $a 2: Assign to $b a reference to $a 3: Assign to $c a reference to $a 4: Assign the value of $b to $c (this does NOT break $c's reference to $a) 6: Assign the value 1 to $a ($a is currently referenced by $b and $c) 8: Echo $c which should be 1. You will get the same result in 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] strange reference behavior
On Sat, 2007-09-01 at 11:39 +0100, Martin Ellingham wrote: Robert Enyedi wrote: Hi, I've been studying the PHP reference mechanism (with PHP 5.2.1) and I'm unsure if the following behavior is normal. This code works as expected: $a = 2; $b = $a; //$c = $a; $c = $b; $a = 1; echo $c.\n; // Prints 2 as expected but this one does not: $a = 2; $b = $a; $c = $a; $c = $b; // Should overwrite the previous assignment, so $c // should get a copy of $b (and NOT a reference) $a = 1; echo $c.\n; // I would expect 2, but prints 1 Could anyone please clarify why this happens? Regards, Robert This is because PHP5 has changed the default behaviour and $a = $b is now call by reference as standard. In the above example no objects have been used. As such, nothing has changed in the above semantics that do not exist in 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] mail() silly question
no difference bastien Date: Sat, 1 Sep 2007 08:00:11 -0500 From: [EMAIL PROTECTED] To: php-general@lists.php.net Subject: [PHP] mail() silly question I have a question that might be too silly for those of you who are PHP gurus. Here it comes: I had a mail (specifically in the headers) function call like this: $header = ; $header .= 'From: [EMAIL PROTECTED]; $header .= 'MIME-Version: 1.0\r\n; $header .= 'Content-type: text/html; charset=iso-8859-1\r\n; $header .= Reply-To: .utf8_decode($nombreVar). .utf8_decode($apellidosVar).\r\n; $header .= X-Mailer: PHP/.phpversion().\r\n; $header .= X-Priority: 1; and the mail(...) function always returned TRUE, but the mail was NOT sent. After hours of... trial/error debugging, I noticed from an example that it should be: $header = ; $header .= 'From: [EMAIL PROTECTED]' . \r\n; $header .= 'MIME-Version: 1.0' . \r\n; $header .= 'Content-type: text/html; charset=iso-8859-1' . \r\n; $header .= Reply-To: .utf8_decode($nombreVar). .utf8_decode($apellidosVar).\r\n; $header .= X-Mailer: PHP/.phpversion().\r\n; $header .= X-Priority: 1; Question: Why? What's the real difference between $header .= 'From: [EMAIL PROTECTED]' . \r\n; and $header .= 'From: [EMAIL PROTECTED]; ? If somebody knows, please let me know! Thank you in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php _ Discover the new Windows Vista http://search.msn.com/results.aspx?q=windows+vistamkt=en-USform=QBRE -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strange reference behavior
Thanks for the clarifications. Regards, Robert Robert Cummings wrote: On Sat, 2007-09-01 at 11:39 +0100, Martin Ellingham wrote: Robert Enyedi wrote: Hi, I've been studying the PHP reference mechanism (with PHP 5.2.1) and I'm unsure if the following behavior is normal. This code works as expected: $a = 2; $b = $a; //$c = $a; $c = $b; $a = 1; echo $c.\n; // Prints 2 as expected but this one does not: $a = 2; $b = $a; $c = $a; $c = $b; // Should overwrite the previous assignment, so $c // should get a copy of $b (and NOT a reference) $a = 1; echo $c.\n; // I would expect 2, but prints 1 Could anyone please clarify why this happens? Regards, Robert This is because PHP5 has changed the default behaviour and $a = $b is now call by reference as standard. In the above example no objects have been used. As such, nothing has changed in the above semantics that do not exist in PHP4. Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Best Practices for calling 'setup' classes that extend 'parent' classes?
Many thanks :) This was very helpful. On Aug 26, 2007, at 8:27 PM, Richard Lynch wrote: Put all your classes into a single directory structure. Use http://php.net/set_include_path (or php.ini or .htaccess) to provide the FULL PATH to that directory. PHP now knows where to start its search, and essentially prepends that directory when it does an include. Assume this directory structure: /path/to/your/includes parent_class.php /child some_child_class.php This works: ?php set_include_path('/path/to/your/includes'); include 'parent_class.php'; include 'child/some_child_class.php'; ? Do not under any circumstances try to use './' or '../' in your include statements. You will only make yourself miserable in the long run. On Mon, August 20, 2007 1:52 pm, Graham Anderson wrote: What is the best practice for correctly targeting 'include' paths when using Initialization/Setup classes that extend Parent classes? In my extend_parent_class.php file, I have to provide an incorrect relative path. Apparently, the path (that does work) is relative to php file that calls the initialization/setup class (call_the_extend_parent_class.php). Is there a less confusing way to correctly target include paths when creating initialization classes? Should I be using absolute paths instead? many thanks in advance extend_parent_class.php: include_once('./path/to/parent_class.php'); # Works with 'incorrect' relative path //include_once('../path/to/parent_class.php'); # Fatal Error with 'correct' relative path class Initialize_Parent_Class extends Parent_Class { function Initialize_Parent_Class() { $this-Parent_Class(); echo This was successful and does not result in a fatal 'class not found' error; } } Call the initialization class. call_the_extend_parent_class.php: ?php require('./includes/extend_parent_class.php'); # initialize Parent Class $parent_class = new Initialize_Parent_Class(); // prints 'This was successful and does not result in a fatal 'class not found' error' ? File structure: php ++call_the_extend_parent_class.php ++ includes directory extend_parent_class.php ++ classes directory parent_class.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] what is my dns ip address
is there a function in php that will return the ip address of the dns server on the system? eg. $dns_ip = get_dns_ip_address(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what is my dns ip address
Olav Mørkrid wrote: is there a function in php that will return the ip address of the dns server on the system? eg. $dns_ip = get_dns_ip_address(); Don't know of a specific command that returns them, but you could parse the output of nslookup and cache the results. -- Richard Heyes +44 (0)800 0213 172 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php-tidy
I have php4 running on Ubuntu Feisty. I can see php5-tidy in the Synaptic (Package Manager) but can not see php4-tidy or php-tidy. How can I install php4-tidy for php4? -- OOzy Ubuntu-Feisty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php-tidy
OOzy Pal schrieb: I have php4 running on Ubuntu Feisty. I can see php5-tidy in the Synaptic (Package Manager) but can not see php4-tidy or php-tidy. How can I install php4-tidy for php4? On linux: - download the source - untar and go to directory - /path/to/phpize - ./configure ( maybe --help ) - make - make install - enable the new extension in the php.ini - done hth Jens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what is my dns ip address
Richard Heyes wrote: Olav Mørkrid wrote: is there a function in php that will return the ip address of the dns server on the system? eg. $dns_ip = get_dns_ip_address(); Don't know of a specific command that returns them, but you could parse the output of nslookup and cache the results. Or read the contents of /etc/resolv.conf /Per Jessen, Zürich -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what is my dns ip address
Or read the contents of /etc/resolv.conf Faster for static DNS servers, but if you're using DHCP assigned servers, they aren't likely to be in there. -- Richard Heyes +44 (0)800 0213 172 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [EMAIL PROTECTED]: Re: [PHP] what is my dns ip address]
Or read the contents of /etc/resolv.conf I'm not familiar with, but does any MS product have any comparable file? I remember a host(s) ... file somewhere below system32\etc\... but is there any resolv.conf ? I got no win machine here with me, so I can't look it up :-) Faster for static DNS servers, but if you're using DHCP assigned servers, they aren't likely to be in there. [...] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [EMAIL PROTECTED]: Re: [PHP] what is my dns ip address]
Robert Degen wrote: Or read the contents of /etc/resolv.conf I'm not familiar with, but does any MS product have any comparable file? There is a hosts file, but no resolv.conf or equivalent AFAIK. -- Richard Heyes +44 (0)800 0213 172 http://www.websupportsolutions.co.uk Knowledge Base and HelpDesk software that can cut the cost of online support -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: php-tidy
On 9/1/07, Jens Kleikamp [EMAIL PROTECTED] wrote: OOzy Pal schrieb: On 9/1/07, Jens Kleikamp [EMAIL PROTECTED] wrote: OOzy Pal schrieb: I have php4 running on Ubuntu Feisty. I can see php5-tidy in the Synaptic (Package Manager) but can not see php4-tidy or php-tidy. How can I install php4-tidy for php4? On linux: - download the source - untar and go to directory - /path/to/phpize - ./configure ( maybe --help ) - make - make install - enable the new extension in the php.ini - done hth Jens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Great but I got stuck finding the source code. I found the source code for tidy2 which works only for php5. Can you help? try this link: http://pecl.php.net/get/tidy or use cvs to checkout the current source version. http://www.php.net/anoncvs.php hth jens -- codes concepts Gesellschaft für Kommunikation und Informationstechnologie Meffert, Schüller Kleikamp GbR Wormser Str. 55 50677 Köln Fon: +49 (0) 221 719 218 8 Fax: +49 (0) 221 719 218 7 Email:[EMAIL PROTECTED] Internet: http://www.codes-concepts.com Thank you, worked perfect. -- OOzy Ubuntu-Feisty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] question about making modules
Hey, i've been trying alot to make php modules (php based.. not real modules for php in c) but i can't get it working. Here is a sample file: ?php class moduletest { function text() { return moduletestbr /; } } class test_moduletest extends moduletest { function text() { return test_moduletestbr /; } } $test = new moduletest; $test2 = new test_moduletest; echo $test-text(); echo $test2-text(); ? Now what you get when running this file: moduletest test_moduletest That's logical and not the problem The issue is that i want the test_moduletest class to overwrite functions in moduletest but without the need for me to call the class again. So the result i want with $test-text(); == test_moduletest and $test must initialize the moduletest class!! not the test_moduletest class. I want to use this as a (obvious) module system so that others can extend the base class with more advanced features or improve existing features by overwriting them. i did found a place where this is being done: ADOdb Lite but i can't find out how that script is doing it.. Any help with this would be greatly appreciated Thanx, Mark. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] question about making modules
Maybe you should deal with some things like * Plugin-Architecture * Extension Points * States !? A look at wikipedia might give most information you need. Regards rob On Sa, Sep 01, 2007 at 11:23:31 +0200, Mark wrote: Hey, i've been trying alot to make php modules (php based.. not real modules for php in c) but i can't get it working. Here is a sample file: ?php class moduletest { function text() { return moduletestbr /; } } class test_moduletest extends moduletest { function text() { return test_moduletestbr /; } } $test = new moduletest; $test2 = new test_moduletest; echo $test-text(); echo $test2-text(); ? Now what you get when running this file: moduletest test_moduletest That's logical and not the problem The issue is that i want the test_moduletest class to overwrite functions in moduletest but without the need for me to call the class again. So the result i want with $test-text(); == test_moduletest and $test must initialize the moduletest class!! not the test_moduletest class. I want to use this as a (obvious) module system so that others can extend the base class with more advanced features or improve existing features by overwriting them. i did found a place where this is being done: ADOdb Lite but i can't find out how that script is doing it.. Any help with this would be greatly appreciated Thanx, Mark. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Und komm, Du brauchst nur einen Baum um 1000 Streichhölzer herzustellen. Aber Du brauchst nur einen Streichholz um 1000 Bäume abzubrennen. Meine Güte wer soll das denn jetzt verstehen? Ganz egal, komm wir bleiben noch etwas länger. Die Bedeutung zahlt ja immer der Empfänger -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Opensource CPanel
Does anyone recommend a decent server panel, one like cpanel? Something made from PHP preferably? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Pragmatically changing a Record Number
I don't think you really want to do that, either. You don't need a field in the database to accomplish what you are trying to do. Execute your query to select the records you want, sorting them into what ever order you want. When you display the records on your web page, add a PHP variable, say $row_number, which starts at 1, and increments by one for each row you display. -= Bill =- At 3:09 PM -0400 8/29/07, Jason Pruim wrote: And what I'm looking for is away to take rows 4 and 5 and move them to rows 2 and 3 so the next record inserted would be row 4 :) it does not go back and fill in the holes/gaps -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com [EMAIL PROTECTED] -- Reality is the leading cause of stress, for those in touch with it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mail() silly question
As a general rule, use ' ' for literal strings and for strings you want escaped characters and such to take effect. Example: echo 'foo\nbar' will echo foo\nbar where as echo foo\nbar will echo foo bar Hope this helped. Brian Seymour Zend Certified Engineer AeroCoreProductions http://www.aerocore.net/ Cell: (413) 335-2656 -Original Message- From: Rodrigo Poblanno Balp [mailto:[EMAIL PROTECTED] Sent: Saturday, September 01, 2007 9:00 AM To: php-general@lists.php.net Subject: [PHP] mail() silly question I have a question that might be too silly for those of you who are PHP gurus. Here it comes: I had a mail (specifically in the headers) function call like this: $header = ; $header .= 'From: [EMAIL PROTECTED]; $header .= 'MIME-Version: 1.0\r\n; $header .= 'Content-type: text/html; charset=iso-8859-1\r\n; $header .= Reply-To: .utf8_decode($nombreVar). .utf8_decode($apellidosVar).$mailVar\r\n; $header .= X-Mailer: PHP/.phpversion().\r\n; $header .= X-Priority: 1; and the mail(...) function always returned TRUE, but the mail was NOT sent. After hours of... trial/error debugging, I noticed from an example that it should be: $header = ; $header .= 'From: [EMAIL PROTECTED]' . \r\n; $header .= 'MIME-Version: 1.0' . \r\n; $header .= 'Content-type: text/html; charset=iso-8859-1' . \r\n; $header .= Reply-To: .utf8_decode($nombreVar). .utf8_decode($apellidosVar).$mailVar\r\n; $header .= X-Mailer: PHP/.phpversion().\r\n; $header .= X-Priority: 1; Question: Why? What's the real difference between $header .= 'From: [EMAIL PROTECTED]' . \r\n; and $header .= 'From: [EMAIL PROTECTED]; ? If somebody knows, please let me know! Thank you in advance. -- 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