[DOC-CVS] [doc-en] master: setisodate.xml Fix an example (#4919)

[email protected] (Mikhail Alferov via GitHub)
Newsgroups php.doc.cvs
Message-ID <[email protected]>
Author: Mikhail Alferov (mmalferov)
Committer: GitHub (web-flow)
Pusher: kamil-tekiela
Date: 2025-10-12T22:35:43+01:00

Commit: https://github.com/php/doc-en/commit/2cfd69623a8af79d46deaad5ebeb4d9e73b15d6d
Raw diff: https://github.com/php/doc-en/commit/2cfd69623a8af79d46deaad5ebeb4d9e73b15d6d.diff

setisodate.xml Fix an example (#4919)

The first example seems to have been moved from a mutable DateTime :) We need to assign the result of the method to a variable

Changed paths:
  M  reference/datetime/datetimeimmutable/setisodate.xml


Diff:

diff --git a/reference/datetime/datetimeimmutable/setisodate.xml b/reference/datetime/datetimeimmutable/setisodate.xml
index fb25fb0ff2ab..f443c96d52c1 100644
--- a/reference/datetime/datetimeimmutable/setisodate.xml
+++ b/reference/datetime/datetimeimmutable/setisodate.xml
@@ -66,13 +66,14 @@
    <programlisting role="php">
 <![CDATA[
 <?php
+
 $date = new DateTimeImmutable();
 
-$date->setISODate(2008, 2);
-echo $date->format('Y-m-d') . "\n";
+$newDate = $date->setISODate(2008, 2);
+echo $newDate->format('Y-m-d') . "\n";
 
-$date->setISODate(2008, 2, 7);
-echo $date->format('Y-m-d') . "\n";
+$newDate = $date->setISODate(2008, 2, 7);
+echo $newDate->format('Y-m-d') . "\n";
 ?>
 ]]>
    </programlisting>
@@ -80,6 +81,7 @@ echo $date->format('Y-m-d') . "\n";
    <programlisting role="php">
 <![CDATA[
 <?php
+
 $date = date_create();
 
 date_isodate_set($date, 2008, 2);
@@ -103,6 +105,7 @@ echo date_format($date, 'Y-m-d') . "\n";
    <programlisting role="php">
 <![CDATA[
 <?php
+
 $date = new DateTimeImmutable();
 
 $newDate = $date->setISODate(2008, 2, 7);
@@ -130,6 +133,7 @@ echo $newDate->format('Y-m-d') . "\n";
    <programlisting role="php">
 <![CDATA[
 <?php
+
 $date = new DateTimeImmutable();
 $newDate = $date->setISODate(2008, 14);
 echo $newDate->format('n');
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.