Skip to content
Advertisement

What is the meaning of double underscore in PHP?

I have a PHP function from the Internet like this:

function Del_Inflection_Suffixes($kata) {
    $kataAsal = $kata;
    if(preg_match('/([km]u|nya|[kl]ah|pun)$/', $kata)) { // Cek Inflection Suffixes
        $__kata = preg_match_replace('/([km]u|nya|[kl]ah|pun)$/', '', $kata);
        if(preg_match('([klt]ah|pun)$', $kata)) { // Jika berupa particles (“-lah”,     “-kah”, “-tah” atau “-pun”)
            if(preg_match('/([km]u|nya)$/', $__kata)) { // Hapus Possesive Pronouns (“-ku”, “-mu”, atau “-nya”)
                $__kata__ = preg_match_replace('/([km]u|nya)$/', '', $__kata);
                return $__kata__;
            }
        }
        return $__kata;
    }
    return $kataAsal;
}

What is the meaning of $___kata and $_kata?

Is that the same as $kata on the top of function?

Advertisement

Answer

They are different variables. They aren’t related in any special way. $foo, $__foo__ and $__foo are all simply different variables like $a, $b, $c.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement