Laravel collections

méthode dump()

Quand est apparue cette méthode ?

depuis Laravel v5.5

Description


Exemples

Il y a 1 exemple pour cette collection

Exemple #1 : Démo de dump()

Collection utilisée

    
        // define languages collection
        $this->languages = collect([
            'php',
            'python',
            'javascript',
            'go',
            'c#',
            'java',
            'cobol',
            'basic'
        ]);

        Illuminate\Support\Collection {#413 ▼
            #items: array:8 [▼
                0 => "php"
                1 => "python"
                2 => "javascript"
                3 => "go"
                4 => "c#"
                5 => "java"
                6 => "cobol"
                7 => "basic"
            ]
        }
    

Code source


$languages = collect([
            "php",
            "python",
            "javascript",
            "go",
            "c#",
            "java",
            "cobol",
            "basic"
            ]);

$languages->dump();
echo "This appears after dump because dump don't stop the party !";

Résultat

    
Illuminate\Support\Collection {#1394
  #items: array:8 [
    0 => "php"
    1 => "python"
    2 => "javascript"
    3 => "go"
    4 => "c#"
    5 => "java"
    6 => "cobol"
    7 => "basic"
  ]
}
This appears after dump because dump don't stop the party !