Answers for "implode with system separator php"

PHP
3

what is directory_separator in php

Because in different OS there is different directory separator. In Windows it's \ in Linux it's /. DIRECTORY_SEPARATOR is constant with that OS directory separator. Use it every time in paths.

In you code snippet we clearly see bad practice code. If framework/cms are widely used it doesn't mean that it's using best practice code.
Posted by: Guest on January-18-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