473,408 Members | 1,762 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Why does "var_dump" give me different data than "echo"?

Hi there,

I am putting some decimal data from a database into an array, in order to draw a graph. This works generally without problem. But from time to time, the graph doesn't display correctly.

Now, while echoing the data I get this:
Expand|Select|Wrap|Line Numbers
  1. 43.2
  2. 45.2
  3. 49.6
  4. 56.2
  5. 65.1
  6. 70.2
  7. 50.5
  8. 38
  9. 36.6
  10. 14.3
  11. 15.2
  12. 6.6
  13. 4.1
  14. 5.4

Strange thing is that if I use a var_dump, I get this that is no more decimal data, but only integers:
Expand|Select|Wrap|Line Numbers
  1. array(1) { [0]=> array(14) { [0]=> string(2) "43" [1]=> string(2) "45" [2]=> string(2) "50" [3]=> string(2) "56" [4]=> string(2) "65" [5]=> string(2) "70" [6]=> string(2) "50" [7]=> string(2) "38" [8]=> string(2) "37" [9]=> string(2) "14" [10]=> string(2) "15" [11]=> string(1) "7" [12]=> string(1) "4" [13]=> string(1) "5" } }

I checked with other decimal data, and there the var_dump output is correct:
Expand|Select|Wrap|Line Numbers
  1. [0]=> string(10) "0.00004316"
that is, giving me the numbers behind the point too.

What can be the reason for this?

Thanks for any hints!
Mar 18 '11 #1

✓ answered by Dormilich

the reason depends on your data processing, as I don’t know that, I can’t really tell something.

PS. your data ain’t integers, they’re strings. generally, any data sent to the browser are strings.

2 1776
Dormilich
8,658 Expert Mod 8TB
the reason depends on your data processing, as I don’t know that, I can’t really tell something.

PS. your data ain’t integers, they’re strings. generally, any data sent to the browser are strings.
Mar 19 '11 #2
Thanks a lot. Got me thinking (into a different direction before) and trying out some stuff, and finding the (formatting) error indeed before that step.
Mar 24 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Vic Spainhower | last post by:
Hello, I am new to php and MySQL and I'm attempting to run a select query on a MySQL database which is working fine except prior to displaying the table with the results from the select query it...
5
by: Deane | last post by:
Has anyone had experience with "function_exists" not finding a function that you KNOW you've defined? I have defined a function we'll call "foo": 1. I know that function has been parsed, because...
13
by: comp.lang.php | last post by:
Other: <input name="school_type_other" size="30" maxlength="75" value="<?php if ($_POST) echo $_POST; else echo str_replace('"', '&quot;', str_replace('\\', '', $result->school_type_other)); ...
1
by: laredotornado | last post by:
Hi, I cannot seem to send emails. What does it mean when the return value from the "mail" function is an empty string? I'm using php 4.3.11 on a Yahoo! hosting environment. Here is the code:...
7
bobzillaforever
by: bobzillaforever | last post by:
I'm unable to get the file(s) in question to read with file_exists(), fread(), or probably any similar function. I've tried it with .txt, .flv, .pdf, .mov, .mp3, and .wmv. I've tried removing the...
2
by: Lan Mind | last post by:
Hello again everybody, My page: http://www.dockhawk.com/ I'm trying to implement some "session security" PHP script mentioned in the "Cross-site request forgery" section of this tutorials...
3
by: GazK | last post by:
I have been using an xml parsing script to parse a number of rss feeds and return relevant results to a database. The script has worked well for a couple of years, despite having very crude...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
jinu1996
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...
0
agi2029
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,...
0
isladogs
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...
0
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.