Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: i'm familiar with php but i'm still confusing with this strange character ....

  1. #11
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    No, I'm not rms.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  2. #12
    Join Date
    Aug 2008
    Location
    karanganyar, solo, indonesia
    Posts
    161
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    RMS IS USED by dolphin and ray software.
    http://www.boonex.com/unity/forums/#...2009-02-02.htm
    ///////////////////////////////////////////////////
    ///// http://www.mediatutorial.web.id
    ///////////////////////////////////////////////////

  3. #13
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Er, I just noticed:
    The @ symbol checks for errors (will return true if it finds errors, otherwise false).
    That's untrue. @ simply causes all errors to be ignored — the return value of the expression is not changed. That means that this:
    PHP Code:
    mysql_connect('localhost''root''');
    if(@
    mysql_connect('localhost''root''')){
      die(
    "Error!");

    This will check to see if there are any errors in connecting to the database, if there are die Error!.
    is untrue: in fact it's completely backwards. If the connection succeeds the value of mysql_connect() is truthy, so that will die iff the call succeeds.

    I said that errors were ignored, but that's not necessarily entirely true: if track_errors is enabled in the server config, the error generated by the expression will still be assigned to the global variable $php_errormsg.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #14
    Join Date
    Aug 2008
    Location
    karanganyar, solo, indonesia
    Posts
    161
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    so , what is it:

    &$name , on this function--> getNickName(&$p);


    and what is it :
    $$name

    ?????
    ///////////////////////////////////////////////////
    ///// http://www.mediatutorial.web.id
    ///////////////////////////////////////////////////

  5. #15
    Join Date
    Apr 2008
    Location
    Limoges, France
    Posts
    395
    Thanks
    13
    Thanked 61 Times in 61 Posts

    Default

    I don't know about the & in your example.

    For the double $$:

    $$name is a variable that has the name of the value of $name. Confusing huh?

    If you do something like:

    PHP Code:
    $name 'jason'// Simple variable

    $$name 'jason'// Create a variable. Replace $name with it's value, jason, thus creating $jason = jason

    echo "$jason"// This outputs jason, even though we didn't type $jason = 'jason'; 
    This is pretty confusing at first. And probably not something a beginner is going to use often. I've used it once for making new variables from information pulled out of a database.

  6. #16
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    And probably not something a beginner is going to use often.
    It's not something that anyone should use. Ever. If you find yourself using it, you're doing it wrong. Probably you would be better off with an associative array.

    The & in the above example makes a reference: it means that in code, those two variables are actually two names for the same thing. Performing an operation on one is the same as performing an operation on the other. For example:
    Code:
    function brokenAddThree($n) {
      // $n is a new copy of $m, so this modification doesn't affect $n itself.
      $n += 3;
    }
    $m = 2;
    brokenAddThree($m);
    $m // 2
    
    function workingAddThree(&$n) {
      // Here, $n is the same thing as $m, so modifying it also modifies $m.
      $n += 3;
    }
    $m = 2;
    workingAddThree($m);
    $m // 5
    Making the references explicitly at calltime, which seems to be what you were doing above, works but is deprecated:
    Code:
    function deprecatedAddThree(&$n) {
      $n += 3;
    }
    $m = 2;
    deprecatedAddThree(&$m); // Throws a deprecation warning
    $m // 5
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #17
    Join Date
    Aug 2008
    Location
    karanganyar, solo, indonesia
    Posts
    161
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by JasonDFR View Post
    I don't know about the & in your example.
    you don't know?

    ups, you should study php again.... he he he
    i see many of them are on dolphin and orca( boonex.com products )

    hi, i agree with twey
    ///////////////////////////////////////////////////
    ///// http://www.mediatutorial.web.id
    ///////////////////////////////////////////////////

  8. #18
    Join Date
    Feb 2009
    Posts
    156
    Thanks
    0
    Thanked 4 Times in 3 Posts

    Default

    @ sign is used when we want to execute any function n ignore any error that is bring produced by this function...
    for instance there is any function , when we are caling that function it gives us a warning message, by using '@' sign that warning message will be discarded...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •