Cara menggunakan introspection in php geeksforgeeks

The introspection functions are rarely used when building a stylesheet. However, they are valuable if something does not work properly - to figure out what's going on: like debugging functions.

Show

The following table lists all introspection functions in Sass:

FunctionDescription & Examplecall(function, arguments...)Calls a function with arguments, and returns the result.content-exists()Checks whether the current mixin was passed a @content block.feature-exists(feature)Checks whether feature is supported by the current Sass implementation.

Example:
feature-exists("at-error");
Result: true

function-exists(functionname)Checks whether the specified function exists.

Example:
function-exists("nonsense")
Result: false

get-function(functionname, css: false)Returns the specified function. If css is true, it returns a plain CSS function instead.global-variable-exists(variablename)Checks whether the specified global variable exists.

Example:
variable-exists(a)
Result: true

inspect(value)Returns a string representation of value.mixin-exists(mixinname)Checks whether the specified mixin exists.

Example:
mixin-exists("important-text")
Result: true

type-of(value)Returns the type of value. Can be number, string, color, list, map, bool, null, function, arglist.

Example:
type-of(15px)
Result: number
type-of(#ff0000)
Result: color

unit(number)Returns the unit associated with a number.

Example:
unit(15px)
Result: px

unitless(number)Checks whether the specified number has a unit associated with it.

Example:
unitless(15px)
Result: false
unitless(15)
Result: true

variable-exists(variablename)Checks whether the specified variable exists in the current scope.

Example:
variable-exists(b)
Result: true

The term PHP is an acronym for PHP: Hypertext Preprocessor. PHP is a server-side scripting language designed specifically for web development. It is open-source which means it is free to download and use. It is very simple to learn and use. The files have the extension “.php”. 

Rasmus Lerdorf inspired the first version of PHP and participated in the later versions. It is an interpreted language and it does not require a compiler. 

PHP | Reflection getModifierNames() Function

Improve Article

Save Article

Like Article

  • Last Updated : 23 Aug, 2021

  • Read
  • Discuss
  • Courses
  • Practice
  • Video
  • Improve Article

    Save Article

    The Reflection::getModifierNames() function is an inbuilt function in PHP which is used to return an array of the specified modifier names.
     

    Syntax:  

    array Reflection::getModifierNames( int $modifiers )

    Parameters: This function accepts single parameter $modifiers which is Bitfield of the modifiers. Here the bitfield is a data structure consisting of a number of adjacent computer memory locations.
    Return Value: This function returns an array of the specified modifier names.
    Below programs illustrate the Reflection::getModifierNames() function in PHP: 
    Program 1:  

    php




    <?php

     

    // Declaring a class Testing

    class Testing

    {

         

        

    public static
    0

        

    public static
    2

        

    public static
    4
    public static
    5
    public static
    6
    public static
    7

        {

    final public
    0
    final public
    1
    final public
    2

        

    final public
    4

    final public
    4

     

    final public
    6

    final public
    7

    final public
    8
    final public
    9<?php0 <?php1<?php2<?php3<?php4<?php5

     

    <?php6

    <?php7

    <?php8 <?php9// Declaring a class Testing0// Declaring a class Testing1

    final public
    8// Declaring a class Testing3

    // Declaring a class Testing4

    Output: 

    public static

     

    Program 2: 

    php




    <?php

     

    // Declaring a class Testing

    class Testing

    {

         

        class2

        

    public static
    2

        class6

    public static
    4
    public static
    6 class9

        {

    final public
    0
    final public
    1
    final public
    2

        

    final public
    4

    final public
    4

     

    final public
    6

    Testing9

    {0

    final public
    9<?php0 <?php1<?php2<?php3{6<?php5

     

    <?php6

    <?php7

    <?php8 <?php9// Declaring a class Testing0// Declaring a class Testing1{0// Declaring a class Testing3

    // Declaring a class Testing4

    Output: 

    final public

     

    Reference: https://www.php.net/manual/en/reflection.getmodifiernames.php


    My Personal Notes arrow_drop_up

    Save

    Please Login to comment...