php-windows Digest 30 Dec 2004 05:06:54 -0000 Issue 2518
Topics (messages 25199 through 25204):
Re: About the unexpected T_VARIABLE
25199 by: Denis Gerasimov
About "\n"
25200 by: michael.skys.com.cn
25201 by: Michael Purdy
25202 by: graeme
25203 by: Jason Barnett
a function question
25204 by: Patrick Roane
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 ---
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 29, 2004 8:41 AM
> To: [email protected]
> Subject: [PHP-WIN] About the unexpected T_VARIABLE
>
> Hi;
>
> I'm new in php. I has try some sample code in the book
> <? php
Has to be <?php (notice space char).
> $hamburger = 4.95;
>
> $milkshake = 1.95;
>
> $cola = .85;
>
> $food = 2 * $hamburger + $milkshake + $cola;
>
> $tax = $food * .075;
>
> $tip = $food * .16;
>
> $total = $food + $tax + $tip;
>
> print "Total cost of the meal is \$$total";
>
> ?>
>
> But I always get "Parse error: syntax error, unexpected T_VARIABLE in
> e:\Inetpub\wwwroot\meal.php on line 2"
>
> So any suggestion
>
> Regards
>
> Michael
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi
I'm new in php, I find the "\n" dosen't work in my machine
<HTML>
<HEAD>
<TITLE>
<?php
echo "Hello World!";
?>
</TITLE>
</HEAD>
<BODY>
<H1>
First PHP page
</H1>
<?php
echo "Hello World!";
echo "\n";
echo "Hello World!";
?>
</BODY>
</HTML>
The result is
First PHP page
Hello World! Hello World!
any suggestion??
--- End Message ---
--- Begin Message ---
Michael
"\n" will not be recognised by your browser. Remember it expects to see
HTML and not DOS style new line markers.
Try
echo '<p>'; or
echo '<br>';
instead
Mike
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, December 29, 2004 7:36 PM
Subject: [PHP-WIN] About "\n"
> Hi
>
> I'm new in php, I find the "\n" dosen't work in my machine
>
> <HTML>
> <HEAD>
> <TITLE>
> <?php
> echo "Hello World!";
> ?>
> </TITLE>
> </HEAD>
> <BODY>
> <H1>
> First PHP page
> </H1>
> <?php
> echo "Hello World!";
> echo "\n";
> echo "Hello World!";
> ?>
>
>
> </BODY>
> </HTML>
>
>
> The result is
> First PHP page
> Hello World! Hello World!
>
> any suggestion??
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Hi,
What the "\n" does is to throw a newline in your source code. So when
the page is displayed look at the source that has been generated you
will see the blank line. This can be useful to make the HTML source
readable. However to get a new line displayed in the browser your need
to use a <br> tag, or equivalent such as a <p> pair.
graeme.
[EMAIL PROTECTED] wrote:
>Hi
>
> I'm new in php, I find the "\n" dosen't work in my machine
>
><HTML>
><HEAD>
><TITLE>
><?php
>echo "Hello World!";
>?>
></TITLE>
></HEAD>
><BODY>
><H1>
>First PHP page
></H1>
><?php
>echo "Hello World!";
>echo "\n";
>echo "Hello World!";
>?>
>
>
></BODY>
></HTML>
>
>
>The result is
>First PHP page
>Hello World! Hello World!
>
>any suggestion??
>
>
>
--- End Message ---
--- Begin Message ---
Graeme wrote:
> Hi,
>
> What the "\n" does is to throw a newline in your source code. So when
> the page is displayed look at the source that has been generated you
> will see the blank line. This can be useful to make the HTML source
> readable. However to get a new line displayed in the browser your need
> to use a <br> tag, or equivalent such as a <p> pair.
>
> graeme.
>
Right. If you are used to the "\n" style of newlines then you can also
use the function nl2br()
http://php.net/manual/en/function.nl2br.php
--
Teach a person to fish...
Ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
PHP Manual: http://php.net/manual/
php-general archives: http://marc.theaimsgroup.com/?l=php-general&w=2
--- End Message ---
--- Begin Message ---
I am trying to create a function that works with two
arguments. the 1st needs to be a suername. The 2nd
needs to be an email address. Next, I have to use case
conversion functions to capitalize the first letter of
the username and convert the email add. to lowercase
characters and finaly check that it contains the @
sign. If I can't find the @ character, return false:
otherwise, I return an array containing the converted
arguments.
Here is my code (which I can't get to work):
<?php
$mail = "[EMAIL PROTECTED]";
$user = "patrick";
function usermail( $user, $mail ) {
global $user;
global $mail;
$user; = ucwords( $user ); // capitalizes the
//'p' in patrick
$mail; = strtolower( $mail ); // converts all
//of FOJOMO into lower case
if ( strstr( $mail ), "@" )) {
// searches for the '@' sign
user_array = explode("-", $user, $mail); // this
//function (explode) creates the array
} else {
print "Please enter a valid e-mail address"; //
default if test fails to //find the '@' sign
}
?>
=====
----------------
"forget your lust for the rich man's gold. All that you need, is in your soul.
You can do this if you try. All that I want for you my son, is to be satisfied"
~ Lynard Skynard
--- End Message ---