Search
 
SCRIPT & CODE EXAMPLE
 

PHP

list() php

$info = array('Doina', 'brown', 'long');

// Listing all the variables
list($she, $color, $hear) = $info;
echo "$she has $color eyes color and $hear black hair.
";
Comment

list function PHP


<?php

$info = array('coffee', 'brown', 'caffeine');

// Listing all the variables
list($drink, $color, $power) = $info;
echo "$drink is $color and $power makes it special.
";

// Listing some of them
list($drink, , $power) = $info;
echo "$drink has $power.
";

// Or let's skip to only the third one
list( , , $power) = $info;
echo "I need $power!
";

// list() doesn't work with strings
list($bar) = "abcde";
var_dump($bar); // NULL
?>

Comment

PREVIOUS NEXT
Code Example
Php :: append data in csv file php 
Php :: what does defined do in php 
Php :: laravel find duplicate rows 
Php :: enqueue css 
Php :: axios post not sending data php 
Php :: How to calculate the sum of values in a list PHP 
Php :: Custom Font Laravel 
Php :: Undefined index: file in upload.php 
Php :: function passing multiple arguments using 3 dots php 
Php :: get file size in php 
Php :: laravel log query for model 
Php :: how to acces sql with php 
Php :: Converting timestamp to time ago in PHP 
Php :: unique key value array php 
Php :: laravel switch 
Php :: today date to ago for the date in php 
Php :: php assign if not null 
Php :: laravel upload file to aws s3 
Php :: curl error (code 3) url malformed laravel 
Php :: .htaccess Prevent access to php.ini 
Php :: mysqli exception handling 
Php :: laravel validate form data unique 
Php :: php apply function to array elements 
Php :: javascript function in php json_encode 
Php :: collection get first element laravel 
Php :: php != operator 
Php :: php class file upload 
Php :: laravel hash namespace 
Php :: debian install php 
Php :: laravel post request page csrf disable 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =