Home » Questions » Questions

Posts by Jane

1 vote
In reply to: PHP: self vs. $this

Here is an example of correct usage of $this and self for non-static
and static member variables:

<?php
class X {
    private $non_static_member = 1;
    private static $static_member = 2;

    function __construct() {
        echo $this->non_static_member . ' '
           . self::$static_member;
    }
}

new X();
?> 

NOTE: This answer was originally posted at StackOverflow.com by Mohit Bumb

  • Jane answered 13 years ago
1 vote

Wow I really didn’t know about this but its not a big code you can try echo “z” after loop Mark is Absolutely Right I use his method but if you want alternative then this may also you can try

            <?php 
                for($i="a"; $i="y"; $i++)
                {
                    echo "$i\n";
                    if($i=="z")
                    {
                    }
                    }
                    echo "z";
            ?>

NOTE: This answer was originally posted at StackOverflow.com by Mohit Bumb

  • Jane answered 13 years ago
Showing 2 results