Hi,
I have a string value, "1,250" (one thousand, two hundred and fifty).
Is there a PHP function I can apply to this string that will give me
the value 1250 in a variable? I've tried "intval", but I get a value
of 1 (one), at least in PHP 4.
Thanks for any help, - Dave 1 1639 la***********@zipmail.com wrote: Hi,
I have a string value, "1,250" (one thousand, two hundred and fifty). Is there a PHP function I can apply to this string that will give me the value 1250 in a variable? I've tried "intval", but I get a value of 1 (one), at least in PHP 4.
Thanks for any help, - Dave
<?php
$foo = "1,250";
$bar = intval(str_replace(',', '', $foo) );
printf("foo = %s, bar = %d\n", $foo, $bar);
?>
-david- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: For example John Smith |
last post by:
My source file contains numerical information shaped like this:
32,567,90
32,689,78
et cetera
If I use (longint)$numstr I get 32 as value (logically).
How can I convince php to ignore the...
|
by: Steve |
last post by:
Hi,
I have a very long string, someting like:
DISPLAY=localhost:0.0,FORT_BUFFERED=true,
F_ERROPT1=271\,271\,2\,1\,2\,2\,2\,2,G03BASIS=/opt/g03b05/g03/basis,...
|
by: Michael Hill |
last post by:
Hi, folks.
I am writing a Javascript program that accepts (x, y) data pairs from
a text box and then analyzes that data in various ways. This is my
first time using text area boxes; in the past,...
|
by: Dirtyweeker |
last post by:
Hi,
I have a database which records fitness test results of pupils.
There are the usual name fields and then a series of fields holding results,
e.g. field BP1 and field BP2; each of these...
|
by: Randy |
last post by:
Is there any way to do this? I've tried tellg() followed by seekg(),
inserting the stream buffer to an ostringstream (ala os << is.rdbuf()),
read(), and having no luck.
The problem is, all of...
| |
by: Preben Randhol |
last post by:
Hi
A short newbie question. I would like to extract some values from a
given text file directly into python variables. Can this be done simply
by either standard library or other libraries? Some...
|
by: Ian Eagland |
last post by:
Hi
I am just starting on Visual C (2003) from a VB background. I find it easier
to learn by actually programming. I have fallen over at the first hurdle.
How do you extract a numerical value...
|
by: Charlie Hoffpauir |
last post by:
How do I extract a surname from a name field in which the name is in
the form: <surname, given names>.
My first though was to run an update query, but I can't find the
function that will give me...
|
by: sivadhanekula |
last post by:
Hello Everyone
A quick and direct question: I need a C/C++ program to extract the data from the database and the output should be in CSV "Comma Separated Value" format.
Briefly: I will be given a...
|
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,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |
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,...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
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...
|
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 ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |