Logo of SermonSpeaker Extension Claim

Login Form

Always leading hours in time field

  • Eduard
  • Topic Author
  • Visitor
  • Visitor
5 years 8 months ago - 5 years 8 months ago #2948 by Eduard
Always leading hours in time field was created by Eduard
I found that in the time column will indicate hours, though earlier such was not.

According to custom, decided to see how the function "insertTime". And I found it all strange. In fact, it should work right! But the result on the face. If the value of hours = 0, the condition if($tmp[0]) return true o_O
$tmp = explode(':', $time);
if ($tmp[0])
{

I corrected it is more precise condition if($tmp [0] != 0) - so began to work correctly. - Although it's strangemay be due because I have are using PHP 5.4 - and this condition works on another (Such opinion I have decided, because earlier I used PHP 5.2, and time displayed correctly).
Last edit: 5 years 8 months ago by Eduard.

Please Log in or Create an account to join the conversation.

More
5 years 8 months ago #2950 by Thomas Hunziker
Indeed. The reason is probably that $tmp[0] holds a string with '00' which is in fact not threated "false".
if ((int)$tmp[0])
would work as well and is probably more realiable.

Feel free to rate SermonSpeaker on JED .
Useful documentation for beginners: First Steps & FAQ
How to say "Thank You!": Contribute or support using the Donate button at the bottom of each page.

Please Log in or Create an account to join the conversation.

Time to create page: 0.115 seconds
Powered by Kunena Forum