php-general Digest 10 Jun 2010 03:58:00 -0000 Issue 6790

Topics (messages 305996 through 306003):

Re: Finding a font.
        305996 by: Dan Joseph

Re: Passing large object between methods
        305997 by: mrfroasty
        305998 by: Jim Lucas

Question - foreach.
        305999 by: Shreyas
        306000 by: Adam Richardson
        306001 by: Jim Lucas
        306002 by: Daniel Brown

Re: [PHP-WEBMASTER] I have a question for a php expert....
        306003 by: Daniel Brown

Administrivia:

To subscribe to the digest, e-mail:
        [email protected]

To unsubscribe from the digest, e-mail:
        [email protected]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
On Wed, Jun 9, 2010 at 11:14 AM, tedd <[email protected]> wrote:

>
> I came in late on this thread, so please forgive me if I don't hit the
> mark.
>
> Whenever I need to find the name of a font, I use this:
>
> http://new.myfonts.com/WhatTheFont/
>
>
Wow....  I just tried this out...  I uploaded an image, it looked at it, and
told me what fonts the letters were using.  Thanks Tedd!

-- 
-Dan Joseph

www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month.  Promo
Code "NEWTHINGS" for 10% off initial order

http://www.facebook.com/canishosting
http://www.facebook.com/originalpoetry

--- End Message ---
--- Begin Message ---
<?php
class A{

    public  function someFunction()
    {
        $obj = new B();
        //add more to $obj_A
        $obj->data = "B foo";

        //call a function to add extra info on $obj_A
        $obj = $this->addExtraInfo($obj);

        //debug
        print_r($obj);
        echo "<br />";

    }

    public function addExtraInfo($obj)
    {
        $obj->recs = "B bar";
        return $obj;
    }
}

class B
{
    public $data;
    public $recs;
    public function  __construct()
    {

    }
}

//test
$testObj = new A();
$testObj->someFunction();
?>

<?php
class C{

    public  function someFunction()
    {
        $obj = new D();
        //add more to $obj
        $obj->data = "D foo";

        //call a function to add extra info on $obj
        $this->addExtraInfo($obj);

        //debug
        print_r($obj);
        echo "<br />";

    }

    public function addExtraInfo(&$obj)
    {
        $obj->recs = "D bar";
    }
}

class D
{
    public $data;
    public $recs;
    public function  __construct()
    {

    }
}

//test
$testObj = new C();
$testObj->someFunction();
?>

--- End Message ---
--- Begin Message ---
mrfroasty wrote:
>
> //NOTHING!!!//
>

Well Mr. Froasty, was there a point to your email or do you always send empty
emails with random files attached to them to list the list?  Was their suppose
to be a question along with that email?  You simply forgot to add it?

-- 
Jim Lucas

A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

--- End Message ---
--- Begin Message ---
PHP'ers,

I am reading a PHP book which explains foreach and at the end says : *'When
foreach starts walking through an array, it moves the pointer to
the beginning of the array. You don’t need to reset an array before
walking through it with foreach.'*
*
*
*Does this mean - *
*1) Before I navigate the array, foreach will bring the pointer to the
starting key?*
*2) After the first index, it goes to 2nd, 3rd, and nth? *


Regards,
Shreyas

--- End Message ---
--- Begin Message ---
On Wed, Jun 9, 2010 at 9:49 PM, Shreyas <[email protected]> wrote:

> PHP'ers,
>
> I am reading a PHP book which explains foreach and at the end says : *'When
> foreach starts walking through an array, it moves the pointer to
> the beginning of the array. You don’t need to reset an array before
> walking through it with foreach.'*
> *
> *
> *Does this mean - *
> *1) Before I navigate the array, foreach will bring the pointer to the
> starting key?*
> *2) After the first index, it goes to 2nd, 3rd, and nth? *
>
>
> Regards,
> Shreyas
>

Number 1.

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com

--- End Message ---
--- Begin Message ---
Shreyas wrote:
PHP'ers,

I am reading a PHP book which explains foreach and at the end says : *'When
foreach starts walking through an array, it moves the pointer to
the beginning of the array. You don’t need to reset an array before
walking through it with foreach.'*
*
*
*Does this mean - *
*1) Before I navigate the array, foreach will bring the pointer to the
starting key?*
*2) After the first index, it goes to 2nd, 3rd, and nth? *


Regards,
Shreyas


Here is your best reference:

http://php.net/foreach

Look at the two Notes sections on the top of the page.

The first says this:

Note: When foreach first starts executing, the internal array pointer is automatically reset to the first element of the array. This means that you do not need to call reset() before a foreach loop.

Basically what you said.  But then the second says this

Note: Unless the array is referenced, foreach operates on a copy of the specified array and not the array itself. foreach has some side effects on the array pointer. Don't rely on the array pointer during or after the foreach without resetting it.

--
Jim Lucas

A: Maybe because some people are too annoyed by top-posting.
Q: Why do I not get an answer to my question(s)?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?

--- End Message ---
--- Begin Message ---
On Wed, Jun 9, 2010 at 21:49, Shreyas <[email protected]> wrote:
> PHP'ers,
>
> I am reading a PHP book which explains foreach and at the end says : *'When
> foreach starts walking through an array, it moves the pointer to
> the beginning of the array. You don’t need to reset an array before
> walking through it with foreach.'*
> *
> *
> *Does this mean - *
[snip!]

    An easy way to think about it: foreach is cocky and doesn't give a
damn about the rules array functions or placements have set in place.
It'll start from the beginning, and to hell with everyone else.

    In other words: foreach will iterate wholly; it will count *for*
*each* key in the loop, not just where another portion of the code
left off.

-- 
</Daniel P. Brown>
[email protected] || [email protected]
http://www.parasane.net/ || http://www.pilotpig.net/
We now offer SAME-DAY SETUP on a new line of servers!

--- End Message ---
--- Begin Message ---
On Thu, Jun 10, 2010 at 01:29,  <[email protected]> wrote:
>
> It amazes me that I have figured out the hardest parts to do, but I am 
> stumped on this and cannot get the darn thing to include properly, I would 
> appreciate some instruction as now I am at a loss!

    Clint;

    Send that to the PHP General list and I guarantee that you'll not
only get your answers, but learn even more than you intended (perhaps
more even than you wanted sometimes).

    You can subscribe to that list at http://php.net/mailinglists .

    To get you started, I've forwarded your message there.  Thanks to
reply-all email, you may even get your answers before you get the
chance to hit the "Subscribe" button.  Those guys and gals are pretty
quick.

-- 
</Daniel P. Brown>
[email protected] || [email protected]
http://www.parasane.net/ || http://www.pilotpig.net/
We now offer SAME-DAY SETUP on a new line of servers!

--- End Message ---

Reply via email to