How Can I Check If A Number Is Round Or Not ?
How can i check if a number is round or not ?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Check If Number Is In An Array
how can i check if a specified number is in an array e.g number =5 searching in array (1,2,3,4,5) I know how to do it for a mysql query, but I need to do it in PHP, anyone kno how i could do this. Also say I have several numbers I want to check are in the array, how would I do this.
Check If Number Is A Mulitple Of 3
I'm sure this is very easy, my brain is useless at arithmetic I just need to find if a number is a multiple of 3. Just trying to add a by 2 get one free deal so if they've got 3 or 6 etc then i give one free.
Check Number Off Emails On Server?
in my admin, I want to make an overview of details about my CMS. On of the details is the number of new emails on my server. Can I do this with PHP?
Generate A Random Number & Check DB To See It Is Unique
I have a registration form that once submitted inserts the values into a mysql db. Its a registration form for a trade account (eCommerce site) - basically once a company applies for a trade account, i'd like an Account Number to be generated automatically however obviously this needs to be unique. So ideally i'd would like it to randomly generate an 8 digit number and then check the database to ensure it isn't already in use.
Check Week Number In End Of Year And Begiining Of New Year?
I am creating a little own calendar. Now I want to add a "previous week" and "next week" functionality to the calendar. It is easy to take $thisWeek - 1; and $thisWeek + 1;, but there has to be a check wether it is the last week of the year and it should actually be a new year and head to week number 1. HOW do I make this kind of function? I use the following string names: $thisYear $thisWeek
Round?
how to round up numbers for eg. 5.185 becomes 5.19??
PHP And Round()
I'm ok with : round(118.5) => 119 round(118.15, 1) => 118.2 But why : round(118.815, 2) => 118.81 ??? why not 118.82 ?
ROUND
Can some one explain if this can be fixed using php.ini settings ? echo "round 20.545 -".round(20.545,2)."<br>"; echo "round 20.555 -".round(20.555,2)."<br>"; echo "number_format 20.545 -".number_format(20.545, 2, ',', '.')."<br>"; echo "number_format 20.555 -".number_format(20.555, 2, ',', '.')."<br>"; PHP Version 4.3.0 / FreeBSD round 20.545 -20.55 round 20.555 -20.56 number_format 20.545 -20,55 number_format 20.555 -20,55 PHP Version 4.4.4 / CENTOS round 20.545 -20.55 round 20.555 -20.55 number_format 20.545 -20,55 number_format 20.555 -20,55 PHP Version 5.1.4 / Windows NT round 20.545 -20.55 round 20.555 -20.56 number_format 20.545 -20,55 number_format 20.555 -20,56 I know that the round always goes for the odd but this is not consistence with the SO running PHP
Round Up To Next 0.5
I need to round up to the next (NOT nearest) 0.5 value i.e. 10.56 -> 11 10.45 -> 10.5 10.1 -> 10.5 10.99 -> 11 I've tried: PHP Code:
Round()
I'm having some very cute problem here. It's all about the Round() function in PHP. Here's my code PHP Code:
Round Up To The Next Ten
I need a function that will round up to the next ten, meaning that 6 => 10, 14 => 20, 31 => 40,
Round()
i need help with the round function to round a number up and another down to the next 10.. Example: First number: 32 Second number: 32 I want the first number to be rounded down to the next 10 so the first number after rounded would become 30.. And the second number wants to be rounded up to the next 10 so the second number would be 40 (after rounded).. I have tryed the ceil() function to round it up to the next 10 but it does not work..
How Do I Round To The Nearest 0.5
How do I round a number to the nearest and lowest 0.5. I use floor(), but it rounds only to the near whole number. For example, I have a number like 1.94. How do I get it to round to the nearest AND lowest 0.5 increment number as in 1.5.
Round Digits
how do you round digits such as 66.666667 to 66.7 in php?
Possible Bug In Round Function
PHP 5.0.5 running on Win2k Server $rate = 0.015; $value = 15; echo $rate * $value; echo "<BR>"; echo round($rate * $value , 2); output: 0.225 0.22 Shouldn't this be? 0.225 0.23
Getting Round Numbers
$new_width=$_POST['new_width']; $existing_width=$_POST['existing_width']; $existing_height=$_POST['existing_height']; $new_height = ($new_width/$existing_width) * $existing_height; The above returns too many digits I need to round it to the closest inferior number if not equal to .5 or to the superior number if above .5 I do not think that the round function can be used or I do not find the correct way to use it.
Round Up (only Integers)
How do I make a variable into an interger number. Say I have $number = ƈ.5'. How can I make it round up to the next number, such as $number = Ɖ'.
Round Function Issue
I am having a little problem that I am hoping someone can help me out with. In one of my scripts, I am working with some dollar values, and using round to change the result calculated values into a dollar value with cents etc...so I should be getting $200.43 instead of $200.42987 etc.
Round And Ceil Problem
I have a problem that I can't seem to solve. I have checked the round, ceil and floor functions and they don't seem to do what I want. I have an entry like this <?php $tax = .065; $ad2day = 104.50; $ad2day = round(($ad2day * $tax)+ $ad2day, 2); echo printf ("%.2f", $ad2day); ?> That outputs $111.29, the result of multiplying 104.50x.065 with the answer rounded to 2 decimal places, then adding in the 104.50 of the $ad1day variable. What I want to do is multiply the $ad2day variable by the $tax and come up with a result that will round up any remainder past two decimal places to the next decmial place. In the example above, the ($ad2day * $tax) comes out to 6.7925. I want to round that up to 2 decimal places to 6.80 if there is *any* remainder past the two digits. So 6.2401 would be 6.25, 6.2499 would be 6.25, etc. Round doesn't seem to do it and ceil only works (i think anyway) rounding up to whole numbers. What do I need to do to get the result the way I want it?
Curly Braces Round Variables
i thought i was in a pretty good routine when typing my code but now everywhere i see this: {$variable} when i normally do just: $variable can anyone tell me why this needs done? and should i make it a rule of thumb to do it also?
Replace Hex Number Or Decimal Number In A String ?
String may contain alphanumeric values. What is the bestway to replace a hex number such as 0x122aaa and decimal number such as 5678 with a string "blah" Example: I want to replace below-- wr_thru1 data or mask mismatch!! for addr=0x00000b73a0540 & mdfid:11 with wr_thru1 data or mask mismatch!! for addr=hexVal & mdfid:decVal
Order Number Or Tracking Number
I need to create some kind of random number within a persons session that can be inserted into a customer id column for their orders, customer, and credit card tables. Unless their is a better way to link a customers information together between a few tables besides using auto increment. Things could get screwed up for me if I use auto increment, especially if someone submits their information but does not actually place an order. My question is " How can I create a random order number that can be used within a persons session and will stay the same throughout the whole program for that one person? "
Database Stores Default Number Everytime, But I Havent Set A Default Number??
Im having some problems with my database. Everytime i store a number which is longer than 10 numbers the script or database puts this number into the database: 2147483647. Its does this everytime no mather how i write the numbers and nomather how long the number is, it just needs to be over 10. I have set any default value in the database and to be sure i havent i tried deleting the table, but same thing happends again???
Check Box?
i am trying to create few check box in one page without a submit button, and there are 5 have which is some with this. User only able to click submit in the last page after he make a selection after these 5 page. How can it keep the selected check box so that i can process in last page. I had heard there are one way to create a onclick function inside check box but how?
How To Check An URL ..?
I am a beginner in PHP. Does anybody know how to check if an URL is alive or dead in PHP (not exist or server down...or whatever ) ?
CHECK URL
How it can be checked that a URL exists or not in PHP.There is one way is to use fopen function then passing the URL as a parameter. Like this, <? $URL = "http://www.abc.com"; $fp = @fopen ($URL, "r"); if (!$fp) { die ("Cannot open website $URL!"); } ?> But I think that there should have some other smart technique.
Can I Check SSL Somehow With PHP?
Ever since I got a server for our site, it just opens new issues. Here is the problem: My SSL Cert somehow got corrupted. The server is managed, so they fixed it right away once I noticed it, but nobody was able to checkout until it was fixed, and I cannot check the site every hour. Here is what I want to do (but the server people say it is not possible): Is there a way, by chron or otherwise, to run a PHP that requests a secure page, and if it does not respond, it emails a warning? It seems that this should be able to be done without too much trouble. Any ideas?
How To Check Id
I was wondering how to get the id that has the biggest number and then add 1 to it so I can have an id field id name 1 test 2 test1
Eregi For URL Check
Can someone hook it up with an eregi expression to check URLs for validity?
Check For Folder
how would i check if there's at least one folder in the current folder? the current folder is $dir/$f/ this is what i have, but i know its wrong $fillle = "$dir/$f/"; if (file_exists($fillle)) {$Q="true";} else{$Q="false";}
How To Check If I've Been CHMODED 220 ?
My host and I have come to a dissagreament on filedownload sizes, and everyday when I wake up, I see that I'm back to 220 for that /files/ directory. I'd like to point out that it's nothing illegal, it's just gamepatches, and yes... these can get quite big. Now, untill I settle that, I need to redirect my visitors IF that site is innaccessible to another box... how can i detect if the user gets a 403 page so that I can redirect him? Had a look at "socket_read()" etc... but can't make heads or tail in it yet, will keep looking in there, but if someone can give me a push in the right direction, I'd apreciate it.
How To Check For Multiple @'s
We are trying to prevent spammers from mass mailing their list while using our contact us script. We have a few security measures in place but would also like to add a "check for more than 1 @'s in the to:, cc: and bcc: fields. Can anyone point us to some code or turotials for doing this?
Check A String
Hey everyone, how would I check a string for having only numbers and having 4 integers exactly?
How To Check If 2 Vars Is Not Set?
How to check if 2 vars is not set? I started with this if (!isset($x,$y)){ and tried many like below but gave up. if (!isset($x)) || (!isset($y){ if ((!isset($x)) || ((!isset($y)){
Check Data Not Already In D/b
Hwo can you do it, on an insert query so that it will check whether there is a record with the same info, say club name for example, and then if u try input same thing again it will reject it.
How To Check If Theres Something In STDIN
How do i check if there is something new in STDIN? I ran into this problem when i was doing some simple command line script that takes input from STDIN. And i noticed that feof() always returns TRUE with STDIN. Also it seems that if i fread(STDIN) and there is nothing in STDIN, it waits forever for input. So i was wondering if there is some way to check how much stuff there is in STDIN and then read it, because i dont want to wait for the input forever.
How To Check SessionID Available Or Not?
I am working on a site in which I need to check whether user is online or not. If user successfully logged out then I can change status from online to offline but if user do not logged out and close the browser or session timeout then in both of the case I do not handle how to change user's status from online to offline.
Check Box Question
I have a small question regarding check box and mail() forms. I have a mail() form on my website and I want to add to it a check box that if checked the user get a copy of the data he sent and if not check the mail is sent to me only please help me doing this because I have tried how to figure it out but I couldnt and the problem is that am not a really good php developer am just a beginer.
Spell Check
I have a form with 6 different fields for the user to fill in. One of the field is the text field and they are suppose to fill in about 6 lines of information. This page/information is dynamically get displayed on my webpage. How do I make sure that before it gets displayed on the web some kind of spell check is done automatically. I did try at php.net. There is a function call Aspell() but I don't know how to get that to work for my problem.
Domain Name Check
I want to check domainnames on my website. Type in a name and you'll see if it exists or not. I've once had a CGI Script dat does this... but I wonder if its also possible in PHP.. and how?
Webmail Check
How would I go about writing a script that checks users GMAIL and HOTMAIL emails and displays it for them? if you go to www.netvibes.com it allows you to check your gmail or hotmail and yahoo accounts right from their website.
Check Image Is Not There
is there an easy way to do a check on a directory to check that a file uploaded using php uplaod fucntion isn't already there, and if so where can i read up on this.
Spell Check
How can I do spell check words? I have a file with a bunch of words in it, I want to eliminate incorrectly spelled words.
|