[PHP] installing PHP 5.3 on MAC with mysqlnd support
Hi! Can somebody give me some guideline how to install PHP 5.3 to a Mac (intel based) with mysqlnd support? TIA! Best Regards, Felhő -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP4 static properties - PEAR vs my solution
Hi! I had a little discussion on a forum topic about static class method and properties. Somebody there pointed to the PEAR::getStaticProperty() solution to emulate static properties in PHP4. I was not familiar with it but its approach seems a little strange for me. It is not really more than storing static properties in a global array. I tried to make something better and come out with this solutions, which I think is much more closer to the philosophy of a static property and maybe is more elegant (of course this is subjective :)). I'm curious about your opinion. Regards, Felhő - ?php class base { function staticProperty($name, $value = null) { static $properties = array(); if (func_num_args() == 2) { $properties[$name] = $value; return $properties[$name]; } else { if (array_key_exists($name, $properties)) { return $properties[$name]; } else { $php4_4suck = null; return $php4_4suck; } } } } class foo extends base { } class bar extends base { } foo::staticProperty('foo', 'foo'); var_dump(bar::staticProperty('foo')); // NULL bar::staticProperty('foo', 'bar'); var_dump(bar::staticProperty('foo')); // bar $foo = new foo(); var_dump($foo-staticProperty('foo')); // foo $bar = new bar(); var_dump($bar-staticProperty('foo')); // bar $fooStaticProp = foo::staticProperty('foo'); $fooStaticProp = 'fooChanged'; var_dump($foo-staticProperty('foo')); // fooChanged ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP4 static properties - PEAR vs my solution
Hi! I had a little discussion on a forum topic about static class method and properties. Somebody there pointed to the PEAR::getStaticProperty() solution to emulate static properties in PHP4. I was not familiar with it but its approach seems a little strange for me. It is not really more than storing static properties in a global array. I tried to make something better and come out with this solutions, which I think is much more closer to the philosophy of a static property and maybe is more elegant (of course this is subjective :)). I'm curious about your opinion. Regards, Felhő - ?php class base { function staticProperty($name, $value = null) { static $properties = array(); if (func_num_args() == 2) { $properties[$name] = $value; return $properties[$name]; } else { if (array_key_exists($name, $properties)) { return $properties[$name]; } else { $php4_4suck = null; return $php4_4suck; } } } } class foo extends base { } class bar extends base { } foo::staticProperty('foo', 'foo'); var_dump(bar::staticProperty('foo')); // NULL bar::staticProperty('foo', 'bar'); var_dump(bar::staticProperty('foo')); // bar $foo = new foo(); var_dump($foo-staticProperty('foo')); // foo $bar = new bar(); var_dump($bar-staticProperty('foo')); // bar $fooStaticProp = foo::staticProperty('foo'); $fooStaticProp = 'fooChanged'; var_dump($foo-staticProperty('foo')); // fooChanged ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP4 static properties - PEAR vs my solution
But users of the PEAR solution to staticProperties may or may not want any other portion of PEAR as well. But they have the possibility to choose. ;) So it's only better if it suits the needs of the user. You'd have to ask the PEAR users if it's better for them. 1. I sent it here because I think it is an interesting solution, it could be useful for any PHP programmer who wants to know more than the surface. 2. I'm not a PEAR fan but I think that PEAR is very close to PHP. Perhaps you meant to post on a PEAR list. I sent it to the pear-dev list too, and I never thought that after a mail they will change the 4 years old code, and make a BC change. I just was curious if they choose knowingly their solution. Regards, Felhő -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] editor
I read somewhere about an editor, which has built in support for phpdocumentator and creating unit test. Now I could not find it, I tried a lot using Google without success. Could it be PHPEdit ? Yes, thx, this is the editor which I tried to find. I already get it last night, after I tried to google not php editor unit test support, but only php editor simpletest. Regards, Felhő -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] editor
Hi! In advance, this is not a yet another editor question. :) I read somewhere about an editor, which has built in support for phpdocumentator and creating unit test. Now I could not find it, I tried a lot using Google without success. Can anybody find out from this little descrition which one could it be? Thx, Felhő -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] editor
Hi! http://www.zend.com/store/products/zend-studio/ Thx, I know this one, but I'm really curious about this unit test support. Regards, Felhő -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] POST parsing troubles
I need to get all the X headears (which I can) plus the content from this POST. My problem is that the content is not a key/value pair, and so does not apear as a _POST[] variable http://hu2.php.net/manual/en/ini.core.php#ini.always-populate-raw-post-data Felh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP arrays and javascript
Hi! Would this work the same for multidimensional arrays? Encoding was a special feature needed by me, maybe you don't need it. Usage: myArray = array(...); echo 'script'.arrayToJsArray($myArray, 'myArray').'/script'; Felho --- 8 --- arrayToJsArray.php --- 8 --- ? function valueToJsValue($value, $encoding = false) { if (!is_numeric($value)) { $value = str_replace('\\', '', $value); $value = str_replace('', '\', $value); $value = ''.$value.''; } if ($encoding) { switch ($encoding) { case 'utf8' : return iconv(ISO-8859-2, UTF-8, $value); break; } } else { return $value; } } function arrayToJsArray( $array, $name, $nl = \n, $encoding = false ) { if (is_array($array)) { $jsArray = $name . ' = new Array();'.$nl; foreach($array as $key = $value) { switch (gettype($value)) { case 'unknown type': case 'resource': case 'object': break; case 'array': $jsArray .= arrayToJsArray($value, $name.'['.valueToJsValue($key, $encoding).']', $nl); break; case 'NULL': $jsArray .= $name.'['.valueToJsValue($key, $encoding).'] = null;'.$nl; break; case 'boolean': $jsArray .= $name.'['.valueToJsValue($key, $encoding).'] = '.($value ? 'true' : 'false').';'.$nl; break; case 'string': $jsArray .= $name.'['.valueToJsValue($key, $encoding).'] = '.valueToJsValue($value, $encoding).';'.$nl; break; case 'double': case 'integer': $jsArray .= $name.'['.valueToJsValue($key, $encoding).'] = '.$value.';'.$nl; break; default: trigger_error('Hoppa, egy új típus a PHP-ben? '.__CLASS__.'::'.__FUNCTION__.'()!', E_USER_WARNING); } } return $jsArray; } else { return false; } } ? --- 8 --- arrayToJsArray.php --- 8 --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php compiler
I kind of hinted in my earlier what is going on but: $a = 1 $b = 0; Is first silently evaluated as: $a = (1 $b = 0); thx your answer, just one more little thing... So the right expression is tested which happens to be ($b = 0). ...why ($b = 0) is on the right side, not only $b. Felho u.i. Is there any information, why PHP was implemented this way? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PLEASE HELP ON MAIL FUNCTION
http://www.phpclasses.org/mimemessage Or you can try is, which is one of the best mailer class: http://phpmailer.sourceforge.net/ Felho -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php compiler
Hi! I think the precedence of left and right associative operands can't be compared. The switch between associativities already separates the expression (if it could be explained this way). Yes, this behaviour confused me. This is not common in other programming languages: o C : invalid lvalue in assignment o Java : required: variable found : value o JavaScript: invalid assignment left-hand side (Mozilla) syntax error (Internet explorer) But for me it isn't egxactly clear how the evaluation order was calculated (why doesn't the first = operator executed before ). Does anybody know for example a flowchart, how it is implemented in PHP? Felho -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php compiler
Hi! $a = 0; $b = 1; if ($a = 1 $b = 0) { echo 'true '; var_dump($a); var_dump($b); } else { echo 'false '; var_dump($a); var_dump($b); } Runing this we get: true bool(false) int(0) After the precedence table the first step could be evaluating the , but not this is what happen. Can someone exactly explain how PHP process the condition? THX in advance, Felho -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php compiler
Use == instead of = in the if condition. Thx, I know the difference. The exapmle use willfuly =. Felho -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php compiler
It outputs this: false bool(false) int(0) Yes, this the right output. And this output is absolutely correct. Your condition gives new values to $a and $b because you use = and not ==. So you do this: Maybe you never read this: http://hu2.php.net/manual/en/language.operators.php#language.operators.precedence The result is not so obvious. There sould some internal behavior which cause this. Felho -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php compiler
If you see the output, it seems, that PHP evaluate first $b = 0, and this is the problem. $a = 1 $b = 0 PHP sees two expressions here: After the precedence table the first thing should be evaluating 1 $b, so we get: $a = false = 0 Which is not meaningful thing, and maybe this cause that the evaluating of the statment is not in the right order. Felho -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php compiler
= has a right associativity. This is well explained on the page you Oke, but has a higher precedence. The right associativity has sense when all the operand has the same precedence. Felho -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cookies malfunctioning moving from windows to linux
Hi! On the server register_globals = off. Use $_COOKIE['ID'] instead of $ID. Felho u.i. always develop with register_globals = off -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] curl problem
Hi! I try to compile PHP 4.3.4 with curl support on Debian Woody 3.0. I downloaded the http://curl.haxx.se/download/curl-7.11.1.tar.bz2, and compiled it. ./configure was succesfull. But make generate an error: usr/src/install/php-4.3.4/ext/curl/curl.c: In function `curl_free_post': /usr/src/install/php-4.3.4/ext/curl/curl.c:563: warning: passing arg 1 of `curl_formfree' from incompatible pointer type /usr/src/install/php-4.3.4/ext/curl/curl.c: In function `alloc_curl_handle': /usr/src/install/php-4.3.4/ext/curl/curl.c:603: sizeof applied to an incomplete type /usr/src/install/php-4.3.4/ext/curl/curl.c: In function `zif_curl_setopt': /usr/src/install/php-4.3.4/ext/curl/curl.c:838: duplicate case value /usr/src/install/php-4.3.4/ext/curl/curl.c:695: this is the first entry for that value /usr/src/install/php-4.3.4/ext/curl/curl.c:883: warning: passing arg 1 of `curl_formadd' from incompatible pointer type /usr/src/install/php-4.3.4/ext/curl/curl.c:883: warning: passing arg 2 of `curl_formadd' from incompatible pointer type /usr/src/install/php-4.3.4/ext/curl/curl.c:891: warning: passing arg 1 of `curl_formadd' from incompatible pointer type /usr/src/install/php-4.3.4/ext/curl/curl.c:891: warning: passing arg 2 of `curl_formadd' from incompatible pointer type make: *** [ext/curl/curl.lo] Error 1 The problem is that HttpPost structure is not definied. Maybe I'm trying to use not the proper version of curl? Thx in advance, Felho -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php