php-general Digest 11 Jan 2010 04:40:24 -0000 Issue 6532
php-general Digest 11 Jan 2010 04:40:24 - Issue 6532 Topics (messages 300941 through 300959): Re: To add the final ? or not... 300941 by: Michael A. Peters 300942 by: Michael A. Peters 300943 by: Stuart Dallas 300944 by: Michael A. Peters 300945 by: Jim Lucas 300946 by: Ashley Sheridan Re: Clean PHP 5.2.12 Build Core Dumping 300947 by: Don O'Neil PMCÉú²ú¼Æ»®ÓëÎïÁÏ¿ØÖÆ 300948 by: rjotqr Upgraded PHP now website doesn't work properly? 300949 by: Kaya Saman 300950 by: Ashley Sheridan 300951 by: Ashley Sheridan 300952 by: Kenneth Sande 300953 by: Kaya Saman 300954 by: Ashley Sheridan 300955 by: Kaya Saman 300956 by: Ashley Sheridan 300957 by: Kaya Saman Formatting Decimals 300958 by: Rick Dwyer 300959 by: Mattias Thorslund Administrivia: To subscribe to the digest, e-mail: php-general-digest-subscr...@lists.php.net To unsubscribe from the digest, e-mail: php-general-digest-unsubscr...@lists.php.net To post to the list, e-mail: php-gene...@lists.php.net -- ---BeginMessage--- Daevid Vincent wrote: What do you guys all do? I keep it there, and just make sure not to have white space where it should not be. ---End Message--- ---BeginMessage--- Stuart Dallas wrote: That's a massive assumption. There are a number of editors that automatically add a blank line to the end of source files. I stand by taking the option that requires the least conscious thought from your developers - they have enough important stuff to occupy their brain that remembering to make sure there is no whitespace at the end of their source files should not be one of them. -Stuart I would suggest getting a text editor that doesn't do that then. There are text editors that don't. There also are e-mail clients that properly wrap the body content before sending ;) ---End Message--- ---BeginMessage--- On 10 Jan 2010, at 14:44, Michael A. Peters wrote: Stuart Dallas wrote: That's a massive assumption. There are a number of editors that automatically add a blank line to the end of source files. I stand by taking the option that requires the least conscious thought from your developers - they have enough important stuff to occupy their brain that remembering to make sure there is no whitespace at the end of their source files should not be one of them. -Stuart I would suggest getting a text editor that doesn't do that then. There are text editors that don't. There also are e-mail clients that properly wrap the body content before sending ;) I would rather not have a requirement on the tools my developers use which potentially (and usually) improves their productivity than impose a requirement that has no apparent benefit outside of XML files, and even then the benefit is irrelevant since it's already a file that contains both code and XML. And if you don't like the way my emails look feel free to forward them into a black hole, I'll be fine with that. Alternatively talk to Apple and get them to change their Mail app to your idea or properly. Either way I'm going to get back to worrying about things that matter. ;) -Stuart -- http://stut.net/---End Message--- ---BeginMessage--- Stuart Dallas wrote: On 10 Jan 2010, at 14:44, Michael A. Peters wrote: Stuart Dallas wrote: That's a massive assumption. There are a number of editors that automatically add a blank line to the end of source files. I stand by taking the option that requires the least conscious thought from your developers - they have enough important stuff to occupy their brain that remembering to make sure there is no whitespace at the end of their source files should not be one of them. -Stuart I would suggest getting a text editor that doesn't do that then. There are text editors that don't. There also are e-mail clients that properly wrap the body content before sending ;) I would rather not have a requirement on the tools my developers use which potentially (and usually) improves their productivity than impose a requirement that has no apparent benefit outside of XML files, and even then the benefit is irrelevant since it's already a file that contains both code and XML. And if you don't like the way my emails look feel free to forward them into a black hole, I'll be fine with that. Alternatively talk to Apple and get them to change their Mail app to your idea or properly. Either way I'm going to get back to worrying about things that matter. ;) -Stuart I suspect that you just don't word wrap enabled in your Mail.app preferences. That use to be an option anyway (I haven't used OS X since 10.1) Anyway, I didn't fix the wrap on this before replying just to show what happens. Each paragraph end up as a big long line instead of having a break put in. Ah
Re: [PHP] Clean PHP 5.2.12 Build Core Dumping
Don O'Neil wrote: Core was generated by `php'. Program terminated with signal 11, Segmentation fault. #0 0x081d50a7 in sqlite3Select (pParse=0xbbc00080, p=0x0, eDest=164102200, iParm=0, pParent=0x24, parentTab=139141440, pParentAgg=0x84c10d8, aff=0x0) at /usr/local/directadmin/customapache/php-5.2.11/ext/pdo_sqlite/sqlite/src/sel ect.c:3172 3172 for(j=0; jpGroupBy-nExpr; j++){ First off, the compile directory listed is wrong, don't know where it got php-5.2.11 from I've experienced the same type of issue when building php RPM's on Linux. The solution is to either remove the previous php build or build it in a chroot build environment (such as mock for RPM based distros). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POLL: To add the final ? or not...
Daevid Vincent wrote: What do you guys all do? I keep it there, and just make sure not to have white space where it should not be. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POLL: To add the final ? or not...
Stuart Dallas wrote: That's a massive assumption. There are a number of editors that automatically add a blank line to the end of source files. I stand by taking the option that requires the least conscious thought from your developers - they have enough important stuff to occupy their brain that remembering to make sure there is no whitespace at the end of their source files should not be one of them. -Stuart I would suggest getting a text editor that doesn't do that then. There are text editors that don't. There also are e-mail clients that properly wrap the body content before sending ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POLL: To add the final ? or not...
On 10 Jan 2010, at 14:44, Michael A. Peters wrote: Stuart Dallas wrote: That's a massive assumption. There are a number of editors that automatically add a blank line to the end of source files. I stand by taking the option that requires the least conscious thought from your developers - they have enough important stuff to occupy their brain that remembering to make sure there is no whitespace at the end of their source files should not be one of them. -Stuart I would suggest getting a text editor that doesn't do that then. There are text editors that don't. There also are e-mail clients that properly wrap the body content before sending ;) I would rather not have a requirement on the tools my developers use which potentially (and usually) improves their productivity than impose a requirement that has no apparent benefit outside of XML files, and even then the benefit is irrelevant since it's already a file that contains both code and XML. And if you don't like the way my emails look feel free to forward them into a black hole, I'll be fine with that. Alternatively talk to Apple and get them to change their Mail app to your idea or properly. Either way I'm going to get back to worrying about things that matter. ;) -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POLL: To add the final ? or not...
Stuart Dallas wrote: On 10 Jan 2010, at 14:44, Michael A. Peters wrote: Stuart Dallas wrote: That's a massive assumption. There are a number of editors that automatically add a blank line to the end of source files. I stand by taking the option that requires the least conscious thought from your developers - they have enough important stuff to occupy their brain that remembering to make sure there is no whitespace at the end of their source files should not be one of them. -Stuart I would suggest getting a text editor that doesn't do that then. There are text editors that don't. There also are e-mail clients that properly wrap the body content before sending ;) I would rather not have a requirement on the tools my developers use which potentially (and usually) improves their productivity than impose a requirement that has no apparent benefit outside of XML files, and even then the benefit is irrelevant since it's already a file that contains both code and XML. And if you don't like the way my emails look feel free to forward them into a black hole, I'll be fine with that. Alternatively talk to Apple and get them to change their Mail app to your idea or properly. Either way I'm going to get back to worrying about things that matter. ;) -Stuart I suspect that you just don't word wrap enabled in your Mail.app preferences. That use to be an option anyway (I haven't used OS X since 10.1) Anyway, I didn't fix the wrap on this before replying just to show what happens. Each paragraph end up as a big long line instead of having a break put in. Ah well, doesn't bother me as much as HTML mail to lists does ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POLL: To add the final ? or not...
Stuart Dallas wrote: That's a massive assumption. There are a number of editors that automatically add a blank line to the end of source files. A single \n after the final ? doesn't matter anyways. Even if the following example was two different files where the second included the first, it would still have the same results. Simple test: CONTENTS ?php ? ?php echo (headers_sent() ? 'Yes' : 'No'); ? EOF No, as is, this will return 'No'. But if you place /ANY/ character between the ? ?php including a newline, space, tab, etc... it will send the headers. So, basically saying that in this particular case ??php === ?\n?php With all that said, you CAN have a \n at the end of you file directly after the ?. But, you better make sure that nothing else is there along with it. Jim Lucas -Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POLL: To add the final ? or not...
On Sun, 2010-01-10 at 08:52 -0800, Jim Lucas wrote: Stuart Dallas wrote: That's a massive assumption. There are a number of editors that automatically add a blank line to the end of source files. A single \n after the final ? doesn't matter anyways. Even if the following example was two different files where the second included the first, it would still have the same results. Simple test: CONTENTS ?php ? ?php echo (headers_sent() ? 'Yes' : 'No'); ? EOF No, as is, this will return 'No'. But if you place /ANY/ character between the ? ?php including a newline, space, tab, etc... it will send the headers. So, basically saying that in this particular case ??php === ?\n?php With all that said, you CAN have a \n at the end of you file directly after the ?. But, you better make sure that nothing else is there along with it. Jim Lucas -Stuart Or if you're using a multibyte encoding in your file which isn't correctly interpretted... Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] RE: Clean PHP 5.2.12 Build Core Dumping
I tried adding WITHOUT_X11=yes to /etc/make.conf as well as X11BASE= and X11BASE=, but I still get the same error. Remove them. This makes sure they are not defined, not even empty (as in #define BLA - symbol 'BLA' is defined). Where to go from here? Do I have and old version of something that is causing this? I get this error _right away_ before anything is even built. It seems to be a check by the Makefile at port's top level. Ok... I have no definition for X11BASE anywhere, not in my env, not in my /etc/make.conf, nowhwere... However, it's still complaining about X11BASE being deprecated. I tried just adding WITHOUT_X11=yes in /etc/make, and without it. I even searched all the Makefiles in /usr/ports, and in the /usr/ports/lang/php5 dir to find any reference to X11, or X, or X11BASE, but nada... I don't even know where this error message is being generated from. I can't even do a basic make without it immediately spitting out the error: # make X11BASE is now deprecated. Unset X11BASE in make.conf and try again. *** Error code 1 Stop. Where should I look next? Any help is appreciated. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Upgraded PHP now website doesn't work properly?
Hi, I am hoping someone can help me?? I currently run Fedora 11 on an Apple PowerMac G4 and recently performed an upgrade to it which rendered my site completely unsee able for a while but then after re-saving it showed up through my browsers however my menu bar was slightly altered probably due to lack of formatting. Apache error logs claim this: [Sun Jan 10 23:06:23 2010] [error] [client 192.168.1.110] PHP Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/optiplex-networks/links.php on line 20, referer: http://co111w.col111.mail.live.com/mail/InboxLight.aspx?n=454360575 I have attempted to enable PHP debugging but nothing is being shown! To give an idea of where things are going wrong this is the start of the file: ?php # Script 3.4 - index.php // Set the page title and include the HTML header. $page_title = 'Optiplex Networks'; include ('./header.inc'); ? ?php ini_set('display_errors',1); error_reporting(E_ALL|E_STRICT); echo ' table width=100% align=center border=0 bgcolor=#CC trtd align=centerfont size=4strongContributors to Optiplex Networks:/strong/font/td/tr /table pIf it weren't for these projects Optiplex Networks would not have happened. My thanks and regards to everyone involved!/p table width=95% border=1 align=center tr td width=15%div align=center class=style2strongName/strong/div/td td width=20%div align=center class=style2strongAddress/strong/div/td td width=*div align=center class=style2strongDescription/strong/div/td /tr Line 20 is the line beginning with pIf it weren't for... I don't understand why this should be an error as it's basic html! The only php part I have used is just echoing the html out. As shown the echo ' is closed off at the bottom of the file with: '; ? which is fine according the book I read about php. Obviously something is wrong but I can't figure it out, if anyone can give me a hand I'd very much appreciate it! Many thanks, Kaya -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upgraded PHP now website doesn't work properly?
On Mon, 2010-01-11 at 02:52 +0200, Kaya Saman wrote: Hi, I am hoping someone can help me?? I currently run Fedora 11 on an Apple PowerMac G4 and recently performed an upgrade to it which rendered my site completely unsee able for a while but then after re-saving it showed up through my browsers however my menu bar was slightly altered probably due to lack of formatting. Apache error logs claim this: [Sun Jan 10 23:06:23 2010] [error] [client 192.168.1.110] PHP Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/optiplex-networks/links.php on line 20, referer: http://co111w.col111.mail.live.com/mail/InboxLight.aspx?n=454360575 I have attempted to enable PHP debugging but nothing is being shown! To give an idea of where things are going wrong this is the start of the file: ?php # Script 3.4 - index.php // Set the page title and include the HTML header. $page_title = 'Optiplex Networks'; include ('./header.inc'); ? ?php ini_set('display_errors',1); error_reporting(E_ALL|E_STRICT); echo ' table width=100% align=center border=0 bgcolor=#CC trtd align=centerfont size=4strongContributors to Optiplex Networks:/strong/font/td/tr /table pIf it weren't for these projects Optiplex Networks would not have happened. My thanks and regards to everyone involved!/p table width=95% border=1 align=center tr td width=15%div align=center class=style2strongName/strong/div/td td width=20%div align=center class=style2strongAddress/strong/div/td td width=*div align=center class=style2strongDescription/strong/div/td /tr Line 20 is the line beginning with pIf it weren't for... I don't understand why this should be an error as it's basic html! The only php part I have used is just echoing the html out. As shown the echo ' is closed off at the bottom of the file with: '; ? which is fine according the book I read about php. Obviously something is wrong but I can't figure it out, if anyone can give me a hand I'd very much appreciate it! Many thanks, Kaya The main issue I can see is that the single quote string delimiter that you're using is also being used in the HTML text! Have you considered using heredoc syntax instead? echo OUTPUT your html goes here OUTPUT; The only thing to watch out for here is that the OUTPUT; line is all on it's own, and is preceeded with no whitespace at all. Also, the word OUTPUT in this example can be whatever you feel like. The main advantage ti heredoc is that you can use any quote characters you like within the text and you can output any PHP variables in the text also as if you had a double quoted string. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Upgraded PHP now website doesn't work properly?
On Mon, 2010-01-11 at 02:52 +0200, Kaya Saman wrote: Hi, I am hoping someone can help me?? I currently run Fedora 11 on an Apple PowerMac G4 and recently performed an upgrade to it which rendered my site completely unsee able for a while but then after re-saving it showed up through my browsers however my menu bar was slightly altered probably due to lack of formatting. Apache error logs claim this: [Sun Jan 10 23:06:23 2010] [error] [client 192.168.1.110] PHP Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/optiplex-networks/links.php on line 20, referer: http://co111w.col111.mail.live.com/mail/InboxLight.aspx?n=454360575 I have attempted to enable PHP debugging but nothing is being shown! To give an idea of where things are going wrong this is the start of the file: ?php # Script 3.4 - index.php // Set the page title and include the HTML header. $page_title = 'Optiplex Networks'; include ('./header.inc'); ? ?php ini_set('display_errors',1); error_reporting(E_ALL|E_STRICT); echo ' table width=100% align=center border=0 bgcolor=#CC trtd align=centerfont size=4strongContributors to Optiplex Networks:/strong/font/td/tr /table pIf it weren't for these projects Optiplex Networks would not have happened. My thanks and regards to everyone involved!/p table width=95% border=1 align=center tr td width=15%div align=center class=style2strongName/strong/div/td td width=20%div align=center class=style2strongAddress/strong/div/td td width=*div align=center class=style2strongDescription/strong/div/td /tr Line 20 is the line beginning with pIf it weren't for... I don't understand why this should be an error as it's basic html! The only php part I have used is just echoing the html out. As shown the echo ' is closed off at the bottom of the file with: '; ? which is fine according the book I read about php. Obviously something is wrong but I can't figure it out, if anyone can give me a hand I'd very much appreciate it! Many thanks, Kaya I also forgot to mention, it's worth getting an editor that comes with syntax highlighting, as this would have shown you the problem right away. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Upgraded PHP now website doesn't work properly?
Ashley Sheridan wrote: On Mon, 2010-01-11 at 02:52 +0200, Kaya Saman wrote: Hi, I am hoping someone can help me?? I currently run Fedora 11 on an Apple PowerMac G4 and recently performed an upgrade to it which rendered my site completely unsee able for a while but then after re-saving it showed up through my browsers however my menu bar was slightly altered probably due to lack of formatting. Apache error logs claim this: [Sun Jan 10 23:06:23 2010] [error] [client 192.168.1.110] PHP Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/optiplex-networks/links.php on line 20, referer: http://co111w.col111.mail.live.com/mail/InboxLight.aspx?n=454360575 I have attempted to enable PHP debugging but nothing is being shown! To give an idea of where things are going wrong this is the start of the file: ?php # Script 3.4 - index.php // Set the page title and include the HTML header. $page_title = 'Optiplex Networks'; include ('./header.inc'); ? ?php ini_set('display_errors',1); error_reporting(E_ALL|E_STRICT); echo ' table width=100% align=center border=0 bgcolor=#CC trtd align=centerfont size=4strongContributors to Optiplex Networks:/strong/font/td/tr /table pIf it weren't for these projects Optiplex Networks would not have happened. My thanks and regards to everyone involved!/p table width=95% border=1 align=center tr td width=15%div align=center class=style2strongName/strong/div/td td width=20%div align=center class=style2strongAddress/strong/div/td td width=*div align=center class=style2strongDescription/strong/div/td /tr Line 20 is the line beginning with pIf it weren't for... I don't understand why this should be an error as it's basic html! The only php part I have used is just echoing the html out. As shown the echo ' is closed off at the bottom of the file with: '; ? which is fine according the book I read about php. Obviously something is wrong but I can't figure it out, if anyone can give me a hand I'd very much appreciate it! Many thanks, Kaya The main issue I can see is that the single quote string delimiter that you're using is also being used in the HTML text! Have you considered using heredoc syntax instead? echo OUTPUT your html goes here OUTPUT; The only thing to watch out for here is that the OUTPUT; line is all on it's own, and is preceeded with no whitespace at all. Also, the word OUTPUT in this example can be whatever you feel like. The main advantage ti heredoc is that you can use any quote characters you like within the text and you can output any PHP variables in the text also as if you had a double quoted string. Thanks, Ash http://www.ashleysheridan.co.uk Yup, and the single quote shows up right in this line: pIf it weren't for these projects Optiplex Networks would not have Ken Sande/KC8QNI -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upgraded PHP now website doesn't work properly?
I also forgot to mention, it's worth getting an editor that comes with syntax highlighting, as this would have shown you the problem right away. Thanks, Ash http://www.ashleysheridan.co.uk Thanks for both comments Ashley! I will attempt it now. An editor with syntax checking?? Currently my data center is in the UK and I am in Turkey so am having to SSH in and my current text editor is nano. Are there any good CLI based editors that will do highlighting something hopefully not in the vi/vim categories as I really don't get on with them! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upgraded PHP now website doesn't work properly?
On Mon, 2010-01-11 at 03:06 +0200, Kaya Saman wrote: I also forgot to mention, it's worth getting an editor that comes with syntax highlighting, as this would have shown you the problem right away. Thanks, Ash http://www.ashleysheridan.co.uk Thanks for both comments Ashley! I will attempt it now. An editor with syntax checking?? Currently my data center is in the UK and I am in Turkey so am having to SSH in and my current text editor is nano. Are there any good CLI based editors that will do highlighting something hopefully not in the vi/vim categories as I really don't get on with them! I use Kate which comes with KDE on Linux. With KDE's Kioslaves I can edit files directly over SSH via the SFTP protocol. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Upgraded PHP now website doesn't work properly?
I use Kate which comes with KDE on Linux. With KDE's Kioslaves I can edit files directly over SSH via the SFTP protocol. Thanks, Ash http://www.ashleysheridan.co.uk Thank you for the suggestion! Your idea about using echo OUTPUT worked and I now have access to the files again :-) I am not quite sure why the menu comprising of: portal, unix, login etc has become so messed up - totally left aligned as it was fine before my upgrade. (I guess use editor like you say which may highlight the problem; just hope it works with .inc files as well) Regards, Kaya -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upgraded PHP now website doesn't work properly?
On Mon, 2010-01-11 at 03:15 +0200, Kaya Saman wrote: I use Kate which comes with KDE on Linux. With KDE's Kioslaves I can edit files directly over SSH via the SFTP protocol. Thanks, Ash http://www.ashleysheridan.co.uk Thank you for the suggestion! Your idea about using echo OUTPUT worked and I now have access to the files again :-) I am not quite sure why the menu comprising of: portal, unix, login etc has become so messed up - totally left aligned as it was fine before my upgrade. (I guess use editor like you say which may highlight the problem; just hope it works with .inc files as well) Regards, Kaya The Kate editor can syntax highlight in literally dozens of different languages. If it doesn't recognise one right away, you can configure it to recognise a new extension, or just pick the language from a list once the file is opened. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Upgraded PHP now website doesn't work properly?
Depending on the latency and bandwidth you could use X11 forwarding (granted the server supports it) so you could use a non-CLI editor. I think joe has some syntax highlighting, but I've never edited PHP files with it. If you are coming from a windows machine, you can use Cygwin or Xming to set up an X server on the box before SSHing to your data center w/X11 forwarding enabled. -Ken Sande Many thanks to everyone! I currently use a mixture of FreeBSD, Linux, and Solaris/OpenSolaris as operating systems so X11 forwarding is not a problem but maybe quite slow considering the distance between me and my data center right now, and also I have only 1Mbps upstream as the data center uses ADSL which is a restriction on my behalf. Am using SFTP to transfer non-html related stuff and using simple nano or copy-paste from the Gnome terminal. Yeah many options available I know and I guess that's what makes things fun :-) Anyway I'm sure I'll work something out, at worst case I could always VPN once I get a Cisco router out here and get an IPsec tunnel going and do things over NFS mount?? Regards, Kaya -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Formatting Decimals
Hello List. Probably an easy question, but I am not able to format a number to round up from 3 numbers after the decimal to just 2. My code looks like this: $newprice = $.number_format($old_price, 2, ., ,); and this returns $0.109 when I am looking for $0.11. I tried: $newprice = $.round(number_format($old_price, 2, ., ,),2); But no luck. Any help is appreciated. Thanks, --Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Formatting Decimals
Testing this out a little: matt...@mumin:~$ php -r 'echo \$.number_format(0.109, 2, ., ,).\n;' $0.11 matt...@mumin:~$ php -r 'echo $.number_format(0.109, 2, ., ,).\n;' $0.11 matt...@mumin:~$ php -r 'echo $.number_format(0.109, 2, ., ,).\n;' $0.11 I think the $ should be escaped with a backslash when enclosed within double quotes, but even the second and third tries return the correct result for me. Using PHP 5.2.10. Cheers, Mattias Rick Dwyer wrote: Hello List. Probably an easy question, but I am not able to format a number to round up from 3 numbers after the decimal to just 2. My code looks like this: $newprice = $.number_format($old_price, 2, ., ,); and this returns $0.109 when I am looking for $0.11. I tried: $newprice = $.round(number_format($old_price, 2, ., ,),2); But no luck. Any help is appreciated. Thanks, --Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] stream_socket_client via proxy
Hi all, I am trying to use http://code.google.com/p/xmpphp/ package. It uses stream_socket_client to connect to XMPP servers. I am behind a proxy server so obviously this is not working. Tried proxychains but to no avail. Am I missing something obvious? Kranthi. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upgraded PHP now website doesn't work properly?
Emacs/xemacs does syntax highlighting too. On 1/10/10, Kaya Saman samank...@netscape.net wrote: Depending on the latency and bandwidth you could use X11 forwarding (granted the server supports it) so you could use a non-CLI editor. I think joe has some syntax highlighting, but I've never edited PHP files with it. If you are coming from a windows machine, you can use Cygwin or Xming to set up an X server on the box before SSHing to your data center w/X11 forwarding enabled. -Ken Sande Many thanks to everyone! I currently use a mixture of FreeBSD, Linux, and Solaris/OpenSolaris as operating systems so X11 forwarding is not a problem but maybe quite slow considering the distance between me and my data center right now, and also I have only 1Mbps upstream as the data center uses ADSL which is a restriction on my behalf. Am using SFTP to transfer non-html related stuff and using simple nano or copy-paste from the Gnome terminal. Yeah many options available I know and I guess that's what makes things fun :-) Anyway I'm sure I'll work something out, at worst case I could always VPN once I get a Cisco router out here and get an IPsec tunnel going and do things over NFS mount?? Regards, Kaya -- 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
[PHP] Form validation and save the form
Hello Guys, I am trying to validate a form for user input , such that when something is missing load the form again by focusing on the wrong field.Say i don not enter my address so when the form loads everything else is saved and the form points to address field. Thanks Aditya
Re: [PHP] POLL: To add the final ? or not...
On Sun, Jan 10, 2010 at 06:41:19AM -0800, Michael A. Peters wrote: Daevid Vincent wrote: What do you guys all do? I leave it off. I don't want to have to worry about which editor I'm using or whether I accidentally left some whitespace where it shouldn't be. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form validation and save the form
On Sun, Jan 10, 2010 at 11:37:06PM -0600, aditya shukla wrote: Hello Guys, I am trying to validate a form for user input , such that when something is missing load the form again by focusing on the wrong field.Say i don not enter my address so when the form loads everything else is saved and the form points to address field. Typically, you would direct the form back to itself. Then at the top of the form, you'd put a test to determine if the form has been processed before or if this is the first time through. Then you make your decision about missed fields, etc. Like this: == someform.php == ?php if (empty($_POST)) { load_some_values_or_not(); } else { // form has entered data $okay = process_for_errors(); if ($okay) { store_the_data(); header(Location: success.php); exit(); } } ? HTML crap goes here... == end of someform.php == You'll notice that if there are entry errors, execution falls through. In that case, you'll need to do something like this for fields: input type=text name=pizza value=?php echo $_POST['pizza']; ?/ so that the entered data shows up in the fields. First time through, the value attribute will yield nothing. Paul -- Paul M. Foster -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php