PHP array to string and PHP string to array related methods for parsing. What is the PHP array to convert string implode ()? Php $ vegetables [0] corn; $ vegetables [1] broccoli; $ vegetables [2] zucchini; $ textimplode (, $ vegetables) we will introduce today
PHP array to string implode ()
-
php
- $vegetables[0] = "corn";
- $vegetables[1] = "broccoli";
- $vegetables[2] = "zucchini";
- $text = implode(",", $vegetables);
- echo $text;
- ?>
Running result
Corn, broccoli, zucchini
2 PHP string to array explode ()
-
php
- $text = "corn, broccoli, zucchini";
- $vegetables = explode(", ", $text);
- print_r($vegetables);
- ?>
Running result:
- Array
- (
- [0] => corn
- [1] => broccoli
- [2] => zucchini
- )
The above two sections of code are the code we will introduce to you about converting PHP arrays to strings and PHP strings to arrays.
Convert PHP array to string implode ()? Php $ vegetables [0] = "corn"; $ vegetables [1] = "broccoli"; $ vegetables [2] = "zucchini"; $ text = implode (",", $ vegetables )...