Answers for "explode php string by new line"

PHP
2

php explode new line

$values = preg_split('/\r\n|\r|\n/', $myString);
Posted by: Guest on February-06-2021
1

php string parse with separator explode

<?php
// 1. örnek
$pizza  = "dilim1 dilim2 dilim3 dilim4 dilim5 dilim6";
$dilimler = explode(" ", $pizza);
echo $dilimler[0]; // dilim1
echo $dilimler[1]; // dilim2

// 2. örnek
$data = "foo:*:1023:1000::/home/foo:/bin/sh";
list($user, $pass, $uid, $gid, $gecos, $home, $shell) = explode(":", $data);
echo $user; // foo
echo $pass; // *

?>
Posted by: Guest on July-27-2021

Browse Popular Code Answers by Language