PHP : Implodes an array

In this tutorial learn how to implodes an array with any value or without like (,.) etc.

  function implodeArr($array, $with = '')
    {
        return implode($with, $array);
    }

TUTORIAL

<?php

$array = Array
(
    '3' => 10,
    '2' => 2,
    '5' => 'Nakiya',

);
      
      
/**
* Implodes an array.
     *
     *string $with  What to implode it with
     *
     * @return String
     */
    function implodeArr($array, $with = '')
    {
        return implode($with, $array);
    }

      

var_dump(implodeArr($array,','));

OUTPUT : demo


string(11) "10,2,Nakiya"

No comments:

Post a Comment

how to call ssh from vs code

 To call SSH from VS Code, you can use the built-in Remote Development extension. This extension allows you to open a remote folder or works...