Wy in Php 01 is greater than 1 ? 6 1502
At Sat, 12 May 2007 06:28:04 -0700, wbrowse let his monkeys type:
Wy in Php 01 is greater than 1 ?
It's not, not even when comparing these as strings.
echo (01 1) ? 'bigger' : 'equal or smaller';
// outputs: equal or smaller
echo ('01' '1') ? 'bigger' : 'equal or smaller';
// outputs: equal or smaller
Show the code you used to get the result you did if you want more help...
HTH
Sh.
Andy Hassall wrote:
On 12 May 2007 06:28:04 -0700, wb*****@gmail.c om wrote:
>Wy in Php 01 is greater than 1 ?
It isn't. But perhaps you meant something else?
Maybe he mean '01' is bigger than ' 1'. It would be.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
On Sat, 12 May 2007 14:26:19 -0500, Jerry Stuckle <js*******@attg lobal.net>
wrote:
>Andy Hassall wrote:
>On 12 May 2007 06:28:04 -0700, wb*****@gmail.c om wrote:
>>Wy in Php 01 is greater than 1 ?
It isn't. But perhaps you meant something else?
Maybe he mean '01' is bigger than ' 1'. It would be.
But even then:
$ php -r "var_dump(' 01' ' 1');"
bool(false)
$ php -r "var_dump(' 01' < ' 1');"
bool(false)
You have to get down to strcmp() to start showing up a difference, which
strays even further from what the OP posted.
$ cat test.php
<?php
$a = array('01', ' 1', '1');
sort($a);
print join("\n", $a);
?>
$ php test.php
1
1
01
So, back to the OP to clarify what he's on about... but certainly the sort
results above are a reasonable cause for confusion unless you get your head
around exactly when PHP does implicit type conversions.
--
Andy Hassall :: an**@andyh.co.u k :: http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Andy Hassall wrote:
On Sat, 12 May 2007 14:26:19 -0500, Jerry Stuckle <js*******@attg lobal.net>
wrote:
>Andy Hassall wrote:
>>On 12 May 2007 06:28:04 -0700, wb*****@gmail.c om wrote:
Wy in Php 01 is greater than 1 ? It isn't. But perhaps you meant something else?
Maybe he mean '01' is bigger than ' 1'. It would be.
But even then:
$ php -r "var_dump(' 01' ' 1');"
bool(false)
$ php -r "var_dump(' 01' < ' 1');"
bool(false)
You have to get down to strcmp() to start showing up a difference, which
strays even further from what the OP posted.
$ cat test.php
<?php
$a = array('01', ' 1', '1');
sort($a);
print join("\n", $a);
?>
$ php test.php
1
1
01
So, back to the OP to clarify what he's on about... but certainly the sort
results above are a reasonable cause for confusion unless you get your head
around exactly when PHP does implicit type conversions.
Of course you're right... I should think more before replying... :-)
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
First, sorry for telling you so little with this issue and leaving it
for so long without much care from me...
Below you can find the script that made feel confused (I am an early
Php beginner but I have to stop as for professional needs I need to
concentrate my free time on learning VBA...) :
Test it with 01 as I can't test it on my current configuration(s ee
below why).
===========star t==========
<html>
<head>
</head>
<body>
<?php
//lancer recherche $_POST['submit'] dans fichier aide PHP
if (!$_POST['submit'])
{
?>
<form action="<?=$_SE RVER['PHP_SELF']?>" method="post">
Saisissez un nombre : <input name="nombre" size="2">
<input type="submit" name="submit" value="Valider" >
</form>
<?php
}
else
{
$nombre = $_POST['nombre'];
if ($nombre < 0)
{echo 'Vous avez saissi un nombre -';
}
elseif ($nombre 0)
{echo 'Vous avez saissi +';
}
else
{echo 'Vous avez saissi un nombre neutre';
}
}
?>
</body>
</html>
===========end= =========
As I changed computer, I had to reinstall php, apache and I wanted to
test this script again but I had this message:
You don't have permission to access /arch/< on this server.
The other script I run all are working (with forms...) under XP.
It's no big issue for me right now as it's confusing learning 2
languages at the same time... so I am concentrating on vba and leaving
Php for later... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Martin |
last post by:
I am trying to write code that selects a random number in the range 0 to n,
where n can be substantially greater than the RAND_MAX on my system which is
32767. I am using VC++ 2003 FWIW.
As you know, the standard library rand() only returns an integer in the
range 0<=n<=RAND_MAX.
In fact, this problem is posed as an exercise by Andrew Koening in
Accelerated C++. It's Ex 7-9 and it's marked as "difficult" so I don't feel
too bad in asking...
|
by: Massimiliano Alberti |
last post by:
Can someone check this? If it's OK, you can use however you want... :-)
It should search for an element in an array and, if it can't find it, return
the next element.
key is what you are searching, in a *base array of LONG with num elements.
After some tests it seems to work well (the original version was filled with
ASSERTs)
(I will use this function in a bigger look-for-or-insert function)
Some notes:
The function returns the index...
|
by: John Mark Howell |
last post by:
BlankDoes anyone know how to overload the greater than (>) operator? I know that it is probably not in accordance to the framework design patterns, but it would make my code much cleaner.
--
John Mark Howell
|
by: BobRoyAce |
last post by:
Let's say I have a text box on a page in which a user is to enter a monetary
amount and that I want to ensure that the user enters a value greater than
or equal to a certain value that will be determined by interrogating a
database at runtime. There is a button on the page that the user clicks on
to Save the data they have entered. In the click event of this button I want
to check to see if they have entered a value no greater than the...
|
by: Michael Mallete |
last post by:
good day everyone!
i am using postgresql-8.0beta2-dev3 windows port, with postgis-0.9
add-on. anyway, while trying to insert a table using shp2pgsql, i get
this error:
psql:temp.sql:38: ERROR: Unicode characters greater than or equal to
0x10000 are not supported
| |
by: James |
last post by:
i m looking for suggestions in this news groups what is the best way to
delete files greater than x days.
scenario / conditions
a) d:\dir\queue\*.* files to be deleted.
b) no-touch solutions : use filewatcher on the above directory ?
c) the program will run locally on each machine ..or shld i run poll threads
(control by single machine to check other machines, so exe program only
reside on one system ?)
|
by: Stevie |
last post by:
Hello
I'm trying to work out the regular expression for carrying out a simple
'greater than' comparison.
I have a directory with files such as asd345.log, asd346.log,
asd347.log and so on.
|
by: HockeyFan |
last post by:
I'm not sure how to exactly ask this, but expect that it's a Javascript
solution. However, I'll ask the question and maybe someone can point
me to some existing code that will do what I need.
I have an Asp.Net app that's in 2.0 framework. I have a page that is
sort of a storefront sort of page that has a product, a quantity and a
button for "Add To Cart" and one for "Add To Wishlist".
I'd like to disable those two buttons if the...
|
by: minsumoosane |
last post by:
Hello,
Can anyone help me write a php program that have two numbers as input and then choose the greater number of the two.For example, 2 and 7 and choosing 7 as the greater number Thank you so much.
|
by: ciojr |
last post by:
how do i write a sql (ORACLE) statement for where the first word in
the name field is greater than 17 chars?
if i do this
SELECT businessname
FROM tablename
WHERE LEN(businessname) 17;
it will return all records when the combined length of words is
greater than 17.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |