Date with Var_dump Returns String(36)

Posted on 2008-02-06
Medium Priority
Last Modified: 2012-06-27
I am new to PHP.

Why var_dump returns string(36)?

I want to write date for var_dump. Can't figure what's the mistake.

Here is code:


$timeAdjust = strtotime("-8 hours");
var_dump(date("l, F d, Y @ g:i A", $timeAdjust)); //returns string(39) "Wednesday, February 06, 2008 @ 10:07 AM"

Question by:suredazzle
  • 3
  • 2
LVL 48

Accepted Solution

hernst42 earned 1500 total points
ID: 20834399
because the result of the date function is a string, which type did you expect? See http://www.php.net/date

Author Comment

ID: 20834760
Hi Hernst42,

I want exact date like this Wednesday, February 06, 2008 @ 10:07 AM.

It is a string, right?

I want var_dump. Let me try other date function not "strtotime".

Author Comment

ID: 20835322
Hi Hernst42,

Keep return as string, int with var_dump.

Gotta be a way, you write var_dump for date.  :( Let me try more.

$today = date("l, F d, Y @ g:i A");  
var_dump($today); //returns string(38) "Wednesday, February 06, 2008 @ 8:13 PM"

LVL 48

Assisted Solution

hernst42 earned 1500 total points
ID: 20835766
use echo

echo $today;

var_dump is for internal dumping of php-structures for debugging.

Author Closing Comment

ID: 31428579
Hi Hernst42,

Thanks! Echo is best answer.

Try all possibilities. Please anyone knows var_dump, do give suggestion. Need to know what's the mistake.

$timeAdjust = strtotime("-8 hours");
echo date("l, F d, Y @ g:i A", $timeAdjust);
//var_dump($today); //return string(38) "Wednesday, February 06, 2008 @ 2:53 PM"

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
I recently worked on a Wordpress site that utilized the popular ContactForm7 (https://contactform7.com/) plug-in that only sends an email and does not save data. The client wanted the data saved to a custom CRM database. This is my solution.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question