note 124259 added to language.generators.overview

From: Date: Thu, 03 Oct 2019 03:09:15 +0000
Subject: note 124259 added to language.generators.overview
Groups: php.notes 
Request: Send a blank email to php-notes+get-212450@lists.php.net to get a copy of this message
In addition to the note of "montoriusz at gmail dot com": https://www.php.net/manual/en/language.generators.overview.php#119275 "If you need to perform some action when the function is called and before the result is used, you'll have to wrap your generator in another function." You can use Generator::rewind instead (https://www.php.net/manual/en/generator.rewind.php) Sample code: <?php /** function/generator definition **/ echo "calling gen()...\n"; $result = gen(); $result->rewind(); echo "gen() was called\n"; /** iteration **/ ?> ---- Server IP: 208.43.231.9 Probable Submitter: 185.85.3.195 (proxied: 113.160.55.134) ---- Manual Page -- http://php.net/manual/en/language.generators.overview.php Edit -- https://master.php.net/note/edit/124259 Del: integrated -- https://master.php.net/note/delete/124259/integrated Del: useless -- https://master.php.net/note/delete/124259/useless Del: bad code -- https://master.php.net/note/delete/124259/bad+code Del: spam -- https://master.php.net/note/delete/124259/spam Del: non-english -- https://master.php.net/note/delete/124259/non-english Del: in docs -- https://master.php.net/note/delete/124259/in+docs Del: other reasons-- https://master.php.net/note/delete/124259 Reject -- https://master.php.net/note/reject/124259 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#212450) next »