RE: [PHP] newbie's question
Don't know about a correct way but you can use if(empty($variable)) Robbert van Andel -Original Message- From: Frank Wang [mailto:wang960;yahoo.com] Sent: Friday, November 15, 2002 7:10 AM To: [EMAIL PROTECTED] Subject: [PHP] newbie's question Hi, what is the correct way of testing if a string is empty or not? fw -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers.
RE: [PHP] newbie's question
At 11/15/2002 06:09 PM, you wrote: Don't know about a correct way but you can use if(empty($variable)) I may be crazy, but wouldn't if ($variable) work just as well? If the string is empty it'll return a negatory on that check. Lemme double check that. $testVar = ; if ($testVar) { echo Yes; } else { echo No; } Yeah, ok. That ran just fine under 4.2.3. -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: [EMAIL PROTECTED] Web: www.healthtvchannel.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newbie's question
Err... sorry. The logic was there but my fingers got a bit ahead of my brain. The check works, but if you want to just check if it's empty turn the conditional to a negative, like so: if (!$testVar) { etc. } That makes it If NOT $testVar I may be crazy, but wouldn't if ($variable) work just as well? If the string is empty it'll return a negatory on that check. Lemme double check that. $testVar = ; if ($testVar) { echo Yes; } else { echo No; } Yeah, ok. That ran just fine under 4.2.3. -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: [EMAIL PROTECTED] Web: www.healthtvchannel.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] newbie's question
Yes it would. I like to make things complicated :) Robbert van Andel -Original Message- From: Steve Keller [mailto:skeller;healthtvchannel.org] Sent: Friday, November 15, 2002 5:11 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] newbie's question Err... sorry. The logic was there but my fingers got a bit ahead of my brain. The check works, but if you want to just check if it's empty turn the conditional to a negative, like so: if (!$testVar) { etc. } That makes it If NOT $testVar I may be crazy, but wouldn't if ($variable) work just as well? If the string is empty it'll return a negatory on that check. Lemme double check that. $testVar = ; if ($testVar) { echo Yes; } else { echo No; } Yeah, ok. That ran just fine under 4.2.3. -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: [EMAIL PROTECTED] Web: www.healthtvchannel.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers.
Re: [PHP] newbie's question
Hi, That looks good to me, thanks. Steve Keller [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Err... sorry. The logic was there but my fingers got a bit ahead of my brain. The check works, but if you want to just check if it's empty turn the conditional to a negative, like so: if (!$testVar) { etc. } That makes it If NOT $testVar I may be crazy, but wouldn't if ($variable) work just as well? If the string is empty it'll return a negatory on that check. Lemme double check that. $testVar = ; if ($testVar) { echo Yes; } else { echo No; } Yeah, ok. That ran just fine under 4.2.3. -- S. Keller UI Engineer The Health TV Channel, Inc. (a non - profit organization) 3820 Lake Otis Pkwy. Anchorage, AK 99508 907.770.6200 ext.220 907.336.6205 (fax) Email: [EMAIL PROTECTED] Web: www.healthtvchannel.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie's question about \n
If you check the source of your code you'll see that in source the text is in two lines. \n doesn't work as br, so this is about how HTML works, not plain text. Niklas -Original Message- From: KK Lee [mailto:[EMAIL PROTECTED]] Sent: 22. heinäkuuta 2002 14:01 To: [EMAIL PROTECTED] Subject: [PHP] Newbie's question about \n Dear ALL, It seems that i have a very silly problem. I can't get the new line escape character to work. the following is my SIMPLE script and corresponding output. PHP script: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html head titleTEST/title /head body bgcolor=#ff ?php echo this should be printed out:\n; echo this is a second line; ? /body /html Output in IE6: this should be printed out: this is a second line regards, KK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ### This message has been scanned by F-Secure Anti-Virus for Internet Mail. For more information, connect to http://www.F-Secure.com/ ### This message has been scanned by F-Secure Anti-Virus for Internet Mail. For more information, connect to http://www.F-Secure.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie's question about \n
Hello KK, Monday, July 22, 2002, 9:00:47 PM, you wrote: KL Dear ALL, KL It seems that i have a very silly problem. KL I can't get the new line escape character to work. KL the following is my SIMPLE script and corresponding output. KL PHP script: KL !DOCTYPE HTML PUBLIC KL-//W3C//DTD HTML 4.0 Transitional//EN KLhttp://www.w3.org/TR/html4/loose.dtd; KL html KL head KL titleTEST/title KL /head KL body bgcolor=#ff KL ?php KL echo this should be printed out:\n; KL echo this is a second line; KL ? KL /body KL /html KL Output in IE6: KL this should be printed out: this is a second line KL regards, KL KK The browser will ignore newlines use br instead. to use newlines the text could be enclosed in pre text\n more text\n/pre tags, but br is probably what you need. -- Best regards, Tommailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie's question about \n
nl2br() KK Lee wrote: ** This Message Was Virus Checked With : SAVI 3.59 May 2002 Last Updated 8th July 2002 ** Dear ALL, It seems that i have a very silly problem. I can't get the new line escape character to work. the following is my SIMPLE script and corresponding output. PHP script: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; html head titleTEST/title /head body bgcolor=#ff ?php echo this should be printed out:\n; echo this is a second line; ? /body /html Output in IE6: this should be printed out: this is a second line regards, KK -- -- www.curvedvision.com -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie's question about \n
I often use: br\n That way I get a new line in a browser and plain text as well. KK Lee [EMAIL PROTECTED] wrote: Dear ALL, It seems that i have a very silly problem. I can't get the new line escape character to work. the following is my SIMPLE script and corresponding output. PHP script: -//W3C//DTD HTML 4.0 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; echo this should be printed out:\n; echo this is a second line; ? Output in IE6: this should be printed out: this is a second line regards, KK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do You Yahoo!? Yahoo! Health - Feel better, live better
Re: [PHP] Newbie's question about \n
Think of it this way: br creates a line break in HTML Output, \n creates a line break in HTML Code. echo I really\n like\n PHP!; HTML Code: I really like PHP! HTML Output: I really like PHP! HTH It seems that i have a very silly problem. I can't get the new line escape character to work. the following is my SIMPLE script and corresponding output. PHP script: -//W3C//DTD HTML 4.0 Transitional//EN http://www.w3.org/TR/html4/loose.dtd; echo this should be printed out:\n; echo this is a second line; ? Output in IE6: this should be printed out: this is a second line regards, KK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do You Yahoo!? Yahoo! Health - Feel better, live better Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php