On 28 June 2011 18:08, Dave Ingram wrote:
> So what about modifying the loop syntax slightly, to explicitly scope a
> variable in a foreach? Or would this be problematic/counter-intuitive too?
>
> foreach ($abc as var $def) {
> }
>
> and
>
> foreach ($abc as var &$def) {
> }
PHP's scoping behavio
On 06/23/11 21:48, John Crenshaw wrote:
>> I think proposed change is extremely counter intuitive to the design
>> of PHP in regard to scoping and would be a very large bc break, PHP is
>> doing exactly what it is suppose to do here and I wouldn't want it any
>> other way.
> Agreed. Although I gene
>> personally I find that weird, and unintuitive, but changin that in a major
>> or minor version could be changed if we chose to.
> I think it's a behaviour that could be changed in some step like from
> 5.3 to 5.4 or so. Personally I don't think it would influence existing
> implementations much
-Original Message-
From: Derick Rethans [mailto:der...@php.net]
> On Thu, Jun 23, 2011 at 8:49 AM, Martin Scotta wrote:
>
> I think proposed change is extremely counter intuitive to the design
> of PHP in regard to scoping and would be a very large bc break, PHP is
> doing exactly wha
On Thu, 23 Jun 2011, Chris Stockton wrote:
> On Thu, Jun 23, 2011 at 8:49 AM, Martin Scotta wrote:
> > Martin Scotta
> >>
> > foreach ($values as $value) {
> > // use $value
> > }
> > unset ($value); // <-- unset done inside core
> >
> > foreach ($values as $key => $value) {
> > // use $key an
Martin Scotta
On Thu, Jun 23, 2011 at 12:27 PM, Stefan Neufeind wrote:
> On 06/23/2011 05:17 PM, Anthony Ferrara wrote:
> > Personally, I don't care for the concept of a block scope. I do
> > understand that it can have benefits and make certain tasks easier.
> > But it can also lead to weird
> You can always argue that creating smaller methods (like "no methods
> with more than 100 lines" or so) would limit the problems of a forgotten
> (not unset()) reference-variable. But imho that's not the point.
It is the point. Should we support a feature that will not help those
who are follow
Hello,
On Thu, Jun 23, 2011 at 8:49 AM, Martin Scotta wrote:
> Martin Scotta
>>
> foreach ($values as $value) {
> // use $value
> }
> unset ($value); // <-- unset done inside core
>
> foreach ($values as $key => $value) {
> // use $key and $value
> }
> unset ($key, $value); // <-- unset done i
On 06/23/2011 05:17 PM, Anthony Ferrara wrote:
> Personally, I don't care for the concept of a block scope. I do
> understand that it can have benefits and make certain tasks easier.
> But it can also lead to weird bugs and inconsistencies. For example,
> take the following code:
>
> $good = fal
Martin Scotta
On Thu, Jun 23, 2011 at 12:12 PM, Paul Dragoonis wrote:
> On Thu, Jun 23, 2011 at 4:09 PM, Ferenc Kovacs wrote:
>
> > On Thu, Jun 23, 2011 at 5:03 PM, Stefan Neufeind
> wrote:
> >
> > > Hi,
> > >
> > > I've lately discussed with a colleague which scopes of variables exist
> > >
On 06/23/2011 05:09 PM, Ferenc Kovacs wrote:
> On Thu, Jun 23, 2011 at 5:03 PM, Stefan Neufeind wrote:
>
>> I've lately discussed with a colleague which scopes of variables exist
>> for PHP or would probably make sense. In general I think the general
>> idea of having variables available all thro
Personally, I don't care for the concept of a block scope. I do
understand that it can have benefits and make certain tasks easier.
But it can also lead to weird bugs and inconsistencies. For example,
take the following code:
$good = false;
foreach ($array1 as $value) {
$good = $good & $val
Martin Scotta
On Thu, Jun 23, 2011 at 12:09 PM, Ferenc Kovacs wrote:
> On Thu, Jun 23, 2011 at 5:03 PM, Stefan Neufeind wrote:
>
> > Hi,
> >
> > I've lately discussed with a colleague which scopes of variables exist
> > for PHP or would probably make sense. In general I think the general
> >
On Thu, Jun 23, 2011 at 4:09 PM, Ferenc Kovacs wrote:
> On Thu, Jun 23, 2011 at 5:03 PM, Stefan Neufeind wrote:
>
> > Hi,
> >
> > I've lately discussed with a colleague which scopes of variables exist
> > for PHP or would probably make sense. In general I think the general
> > idea of having var
On Thu, Jun 23, 2011 at 5:03 PM, Stefan Neufeind wrote:
> Hi,
>
> I've lately discussed with a colleague which scopes of variables exist
> for PHP or would probably make sense. In general I think the general
> idea of having variables available all throughout a function is okay as
> this allows t
Hi,
I've lately discussed with a colleague which scopes of variables exist
for PHP or would probably make sense. In general I think the general
idea of having variables available all throughout a function is okay as
this allows things like
foreach($vals as $v) {
// ...
$found = true;
}
if($fo
16 matches
Mail list logo