php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #78540 DateInterval documentation has not been updated
Submitted: 2019-09-15 00:24 UTC Modified: -
From: danielklein at airpost dot net Assigned:
Status: Open Package: Documentation problem
PHP Version: 7.3.9 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2019-09-15 00:24 UTC] danielklein at airpost dot net
Description:
------------
---
From manual page: https://php.net/dateinterval.construct
---
The "Example #1 DateInterval example" code now produces different output to that shown, since new properties have been added to the class. It doesn't state how to set any of these new properties with the constructor, in particular the microseconds property.

Test script:
---------------
<?php

$interval = new DateInterval('P2Y4DT6H8M');
var_dump($interval);

?>

Actual result:
--------------
class DateInterval#1 (16) {
  public $y =>
  int(2)
  public $m =>
  int(0)
  public $d =>
  int(4)
  public $h =>
  int(6)
  public $i =>
  int(8)
  public $s =>
  int(0)
  public $f =>
  double(0)
  public $weekday =>
  int(0)
  public $weekday_behavior =>
  int(0)
  public $first_last_day_of =>
  int(0)
  public $invert =>
  int(0)
  public $days =>
  bool(false)
  public $special_type =>
  int(0)
  public $special_amount =>
  int(0)
  public $have_weekday_relative =>
  int(0)
  public $have_special_relative =>
  int(0)
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Oct 19 01:01:27 2019 UTC