Friday, 5 March 2021

PHP List and Parse String

 List 


$my_array = array("Dog","Cat","Horse");


list($a, $b, $c) = $my_array;

echo "I have several animals, a $a, a $b and a $c.";


// Result

I have several animals, a Dog, a Cat and a Horse.


https://www.w3schools.com/php/phptryit.asp?filename=tryphp_func_list



parse_str(string,array)

1)

parse_str("name=Peter&age=43");
echo $name."<br>";
echo $age;

// Result

Peter
43


2)

<?php

$a = [];

parse_str("name=Peter&age=43", $a);

echo print_r($a);

Array

(

    [name] => Peter

    [age] => 43

)

https://www.w3schools.com/php/func_string_parse_str.asp


No comments:

Post a Comment