Sorry, been doing heavy perl and haven't written any PHP in 3 years so a tad
rusty.
Can someone explain why the second expression in this code snippet evaluates
to 7 and not 8?
$a = (int) (0.1 +0.7);
echo $a\n;
$x = (int) ((0.1 + 0.7) * 10);
echo $x\n;
$y = (int) (8);
echo $y\n;
On Thu, 2010-02-18 at 09:47 -0600, Chuck wrote:
Sorry, been doing heavy perl and haven't written any PHP in 3 years so a tad
rusty.
Can someone explain why the second expression in this code snippet evaluates
to 7 and not 8?
$a = (int) (0.1 +0.7);
echo $a\n;
$x = (int) ((0.1 + 0.7)
On Thu, Feb 18, 2010 at 10:50 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:
On Thu, 2010-02-18 at 09:47 -0600, Chuck wrote:
Sorry, been doing heavy perl and haven't written any PHP in 3 years so a tad
rusty.
Can someone explain why the second expression in this code snippet evaluates
On Thu, Feb 18, 2010 at 16:47, Chuck chuck.car...@gmail.com wrote:
Sorry, been doing heavy perl and haven't written any PHP in 3 years so a tad
rusty.
Can someone explain why the second expression in this code snippet evaluates
to 7 and not 8?
$a = (int) (0.1 +0.7);
echo $a\n;
$x =
According to the PHP manual using the same expression, Never cast an
unknown fraction to integer, as this can sometimes lead to unexpected
results. My guess is that since it is an expression of floating
points, that the result is not quite 8 (for whatever reason).
Therefore, it is rounded
Daniel Egeberg wrote:
On Thu, Feb 18, 2010 at 16:47, Chuck chuck.car...@gmail.com wrote:
Sorry, been doing heavy perl and haven't written any PHP in 3 years so a tad
rusty.
Can someone explain why the second expression in this code snippet evaluates
to 7 and not 8?
$a = (int) (0.1 +0.7);
I'm just starting out, this is my script...
?
$name = $_POST['username'];
$name = $name;
$db = mysql_connect(localhost);
mysql_select_db(vinyldealers,$db);
$query = SELECT shops.name FROM shops WHERE name = .$name.;
$result = mysql_query($query);
while ($record = mysql_fetch_assoc($result)) {
Hi,
Friday, January 3, 2003, 4:18:05 PM, you wrote:
AF I'm just starting out, this is my script...
AF ?
AF $name = $_POST['username'];
AF $name = $name;
AF $db = mysql_connect(localhost);
AF mysql_select_db(vinyldealers,$db);
AF $query = SELECT shops.name FROM shops WHERE name = .$name.;
AF
PROTECTED]
Asunto: [PHP] DUMB QUESTION I'M SURE
I'm just starting out, this is my script...
?
$name = $_POST['username'];
$name = $name;
$db = mysql_connect(localhost);
mysql_select_db(vinyldealers,$db);
$query = SELECT shops.name FROM shops WHERE name = .$name.;
$result = mysql_query($query);
while
de enero de 2003 3:18
Para: [EMAIL PROTECTED]
Asunto: [PHP] DUMB QUESTION I'M SURE
I'm just starting out, this is my script...
?
$name = $_POST['username'];
$name = $name;
$db = mysql_connect(localhost);
mysql_select_db(vinyldealers,$db);
$query = SELECT shops.name FROM shops WHERE name = .$name
I think it's just the $query var not having the right number of quotes.
I added single quotes around the value.
?
$name = $_POST['username'];
$name = $name;
$db = mysql_connect(localhost);
mysql_select_db(vinyldealers,$db);
$query = SELECT shops.name FROM shops WHERE name = '.$name.';
$result =
[mailto:[EMAIL PROTECTED]]
### Enviado el: viernes, 03 de enero de 2003 3:18
### Para: [EMAIL PROTECTED]
### Asunto: [PHP] DUMB QUESTION I'M SURE
###
### I'm just starting out, this is my script...
###
### ?
### $name = $_POST['username'];
### $name = $name;
### $db = mysql_connect(localhost
And I feel foolish asking...
What is meant by 'procedural code' ???
--
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
My "dumb" answer :)
Try Google. Type:
"procedural code"
You might want to check,
"object-oriented"
as well...
I'm sure, you'll find helpful explanations...
- E
And I feel foolish asking...
What is meant by 'procedural code' ???
--
Gerard Samuel
http://www.trini0.org:81/
Google didn't have much to offer.
But if I should also check 'object-oriented' then I believe it deals
with classes.
I thought it was something else.
Just trying to figure out if phpdoc is for me, which it seems like its
not :(
Thanks
@ Edwin wrote:
My "dumb" answer :)
Try Google. Type:
Google didn't have much to offer.
Sorry 'bout that. Actually, if you have an idea of what OO
("object-oriented") is, I think I can say that "procedural" is just the
opposite of it.
I tried Google myself and this came out on top:
"Writing Procedural Code in Non-Procedural SQL"
There's a
On Sat, 31 Aug 2002 14:04:11 -0400, you wrote:
And I feel foolish asking...
What is meant by 'procedural code' ???
It's the opposite of declarative code. Here's a page that briefly
explains the difference:
http://www.wdvl.com/Authoring/DB/SQL/BeginSQL/beginSQL2_1.html
and
Here is my stab at it. One person described it as the opposite of OO.
So something similar to -
?php
do_this() {
// do this code
}
do_that() {
// do that code
}
if (isset( $_GET['foo'] )) {
do_this();
} else {
do_that();
}
?
would be considered procedural code.
If Im wrong I
Hey guys, got a basic question for you...
?
function getvar()
{
$vari = bollocks;
}
getvar();
echo $vari;
?
How do I make that function return the variable?
Thanks,
Liam
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
]
Sent: Thursday, August 22, 2002 1:27 PM
Subject: [PHP] Dumb question
Hey guys, got a basic question for you...
?
function getvar()
{
$vari = bollocks;
}
getvar();
echo $vari;
?
How do I make that function return the variable?
Thanks,
Liam
--
PHP General
()
{
global $vari;
$vari = bollocks;
}
getvar();
echo $vari;
?
Best Regards
Bob Irwin
Server Admin Web Programmer
Planet Netcom
- Original Message -
From: Liam MacKenzie [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, August 22, 2002 1:27 PM
Subject: [PHP] Dumb
Some arrays use the format:
$row-data
while some use:
$row['data']
What is the terminology of these types so I sound like I know what I'm talking about.
Also, when and how do each come about?
Dean
, February 27, 2002 11:32 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Dumb question on terminology
Some arrays use the format:
$row-data
while some use:
$row['data']
What is the terminology of these types so I sound like I know what I'm
talking about. Also, when and how do each come about?
Dean
23 matches
Mail list logo