Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #13215
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Arno Welzel <usenet@arnowelzel.de> |
| Newsgroups | comp.lang.php |
| Subject | Re: weird global issue |
| Date | Wed, 19 Mar 2014 16:26:54 +0100 |
| Lines | 47 |
| Message-ID | <5329B73E.1050404@arnowelzel.de> (permalink) |
| References | <ledeug$a34$1@news.albasani.net> <530a450b$0$9514$9b4e6d93@newsspool1.arcor-online.net> <ledm1l$omj$2@news.albasani.net> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | individual.net k3XVfTAWMziLc6MEQCxpFwWZdZudf5G52GmN59Y6GnhGFNLyMT |
| Cancel-Lock | sha1:00H1dIrjrNHsXfMa8PvTznioXfM= |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 |
| In-Reply-To | <ledm1l$omj$2@news.albasani.net> |
| Xref | csiph.com comp.lang.php:13215 |
Show key headers only | View raw
Am 23.02.2014 21:35, schrieb The Natural Philosopher:
> On 23/02/14 18:59, Christoph Michael Becker wrote:
>> The Natural Philosopher wrote:
>>
>>> Consider
>>> <?php
>>> $x=array();
>>>
>>> function foo()
>>> {
>>> global $x;
>>> foreach($x as $p) // fails with invalid type
>>> {
>>> }
>>> }
>>> ?>
>>> ---------
>>>
>>> <?php
>>> $x=array();
>>> global $x;
>>> function foo()
>>> {
>>> global $x;
>>> foreach($x as $p) // works??
>>> {
>>> }
>>> }
>>> ?>
>>> ---------
>>> This behaviour seems only limited to arrays...
>>
>> No (unless there's a bug in a particular PHP version). Your first code
>> sample works fine without even a notice.
>>
>
> It doesn't here, but the code is being 'eval'ed' ...
That's one of the reasons, why it is NOT "nice" to store code in a
database and then use eval() to execute it.
--
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
weird global issue The Natural Philosopher <tnp@invalid.invalid> - 2014-02-23 18:33 +0000
Re: weird global issue richard <noreply@example.com> - 2014-02-23 13:40 -0500
Re: weird global issue Christoph Michael Becker <cmbecker69@arcor.de> - 2014-02-23 19:59 +0100
Re: weird global issue The Natural Philosopher <tnp@invalid.invalid> - 2014-02-23 20:35 +0000
Re: weird global issue Jerry Stuckle <jstucklex@attglobal.net> - 2014-02-23 16:37 -0500
Re: weird global issue Arno Welzel <usenet@arnowelzel.de> - 2014-03-19 16:26 +0100
Re: weird global issue The Natural Philosopher <tnp@invalid.invalid> - 2014-03-19 17:16 +0000
Re: weird global issue Scott Johnson <noonehome@chalupasworld.com> - 2014-03-19 14:21 -0700
Re: weird global issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-02-23 19:16 +0000
Re: weird global issue The Natural Philosopher <tnp@invalid.invalid> - 2014-02-23 20:41 +0000
Re: weird global issue Christoph Michael Becker <cmbecker69@arcor.de> - 2014-02-23 21:49 +0100
Re: weird global issue Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-02-23 20:59 +0000
Re: weird global issue Jerry Stuckle <jstucklex@attglobal.net> - 2014-02-23 16:38 -0500
Re: weird global issue Mladen Gogala <gogala.mladen@gmail.com> - 2014-02-23 22:09 +0000
csiph-web