# Strtotime() returns different results on the same input!

**URL:** <https://forum.kirupa.com/t/strtotime-returns-different-results-on-the-same-input/286271>\
**Category:** Uncategorized\
**Created:** [April 13, 2009, 6:32am UTC](https://forum.kirupa.com/t/strtotime-returns-different-results-on-the-same-input/286271 "2009-04-13T06:32:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NeoDreamer](https://avatars.discourse-cdn.com/v4/letter/n/ccd318/32.png) [@NeoDreamer](https://forum.kirupa.com/u/NeoDreamer)\
**Post date:** [April 13, 2009, 6:32am UTC](https://forum.kirupa.com/t/strtotime-returns-different-results-on-the-same-input/286271/1 "2009-04-13T06:32:51Z")

</div>

Strtotime() is supposed to take an English phrase of some time and convert it into a Unix timestamp. In this code, I grab a time from some website, clean any HTML entities from the time, and then pass it to strtotime(). It returns the empty string, meaning that it failed. However, if I just copy and paste the cleaned string into strtotime(), it returns correctly! What’s going on?

```php

$html = file_get_contents('http://groups.google.com/group/alt.politics.usa/browse_thread/thread/419b783eccd25a13#');

preg_match_all('/<span class="fontsize0">&nbsp;<span class="(?:.*?)" id="oh_l">More options<\/span><\/span>
  <span class="fontsize2">
  (.*?)
/', $html, $result);

echo '$result[1][0] = ' . $result[1][0];
echo '<br />';
echo 'html_entity_decode($result[1][0]) = ' . html_entity_decode($result[1][0]); 
echo '<br />';
echo 'strtotime(html_entity_decode($result[1][0])) = ' . strtotime(html_entity_decode($result[1][0]));
echo '<br />';
echo 'strtotime("Apr 10, 8:19 am") = ' . strtotime("Apr 10, 8:19 am");

```

output:

```auto

**$result[1][0]** = Apr 10, 8:19&nbsp;am
**html_entity_decode($result[1][0])** = Apr 10, 8:19 am
**strtotime(html_entity_decode($result[1][0]))** =
**strtotime("Apr 10, 8:19 am")** = 1239369540

```
