Skip to content

Instantly share code, notes, and snippets.

View mertbuldur's full-sized avatar
🏠
Working from home

Mert Buldur mertbuldur

🏠
Working from home
View GitHub Profile
function humanJoin($array , $glue = ', ',$finalGlue = ' ve '){
$arr = [implode($glue,array_slice($array,0,-1)),...array_slice($array,-1)];
$arr = array_filter($arr,function($e){
return $e != '';
});
return implode($finalGlue,$arr);
}
echo humanJoin(['Ali','Veli','Mehmet']);
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
class indexController extends Controller
{
public function index(){
return view('form');
<?php
$db = new PDO("mysql:host=localhost;dbname=nestable;charset=utf8","root","123123asdasd");
function getTreeArray($parentId,$treeArray = '')
{
global $db;
if(!is_array($treeArray)){ $treeArray = [];}
$data = $db->query("select * from menu where parentId='".$parentId."'")->fetchAll(PDO::FETCH_ASSOC);
foreach ($data as $key => $item) {