Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7508587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:41:55+00:00 2026-05-29T22:41:55+00:00

so I’ve made a clock-time to seconds function, and it works fine when running

  • 0

so I’ve made a clock-time to seconds function, and it works fine when running on it’s on, with the test string…say 12:53:13 PM.

But when I put it in another script (via require, or just copy-pasting) I’m finding a problem, I’m not sure if it’s specifically due to the function, but this is just weird. The string

“PM” is registering as 6 characters instead of 2 like it should, is what a var_dump says. Any ideas why?

I got the time by exploding an imploding a string of the entire date. This is actually the code

$time = explode(" ",$dateallstr);
$time = array($time[5],$time[6]);
$time = implode(" ",$time);

var_dump($time);
//require("timeinsecs.php");

And this is what var_dump returns

array(4) { [0]=> string(2) "11" [1]=> string(2) "14" [2]=> string(2) "55" [3]=> string(6) "PM" }

This is the starting string.

DATEALLSTR: string(45) "Tuesday 14th of February 2012 11:14:55 PM"

Please help, I have no clue why it would do this.

EDIT:

Ok, got the bin2hex. I’m not sure if this whole thing is just the bin2hex.

BIN2HEX504d3c2f693estring(6) “PM”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:41:56+00:00Added an answer on May 29, 2026 at 10:41 pm

    The original string has length 41. It looks like somehow your input carries 4 NUL characters after the text which are not printed but do count to the length:

    var_dump("Tuesday 14th of February 2012 11:14:55 PM");
     => string(41) "Tuesday 14th of February 2012 11:14:55 PM"
    
    var_dump("Tuesday 14th of February 2012 11:14:55 PM\0\0\0\0");
     => string(45) "Tuesday 14th of February 2012 11:14:55 PM"
    

    You can try to trim() the input before explode(), that should get rid of the extra characters:

    $time = explode(" ", trim($dateallstr));
    

    Edit: You’ve skipped the first step of troubleshooting in PHP: viewing the source to see what the web browser doesn’t show. Now that you have posted the hex dump, we see that the last string is actually "PM</i>".

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want to count how many characters a certain string has in PHP, but
I have a French site that I want to parse, but am running into
I want to construct a data frame in an Rcpp function, but when I
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
Specifically, suppose I start with the string string =hello \'i am \' me And
Seemingly simple, but I cannot find anything relevant on the web. What is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.