Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Join array elements with a string
Alias join
<?php implode(string $separator, array $array): string
<?php     public function applyForegroundColor(string $value, string $color): string

    {

        $setCodes   = implode(';', collection($this->parseColor($color))->toArray());

        $unsetCodes = implode(';', collection(['39'])->toArray());



        return sprintf(terminal()->getCsi() . '%sm', $setCodes) . $value . sprintf(terminal()->getCsi() . '%sm', $unsetCodes);
<?php     public function applyForegroundColor(string $value, string $color): string

    {

        $setCodes   = implode(';', collection($this->parseColor($color))->toArray());

        $unsetCodes = implode(';', collection(['39'])->toArray());



        return sprintf(terminal()->getCsi() . '%sm', $setCodes) . $value . sprintf(terminal()->getCsi() . '%sm', $unsetCodes);

    }
<?php     public function applyBackgroundColor(string $value, string $color): string

    {

        $setCodes   = implode(';', collection($this->parseColor($color, true))->toArray());

        $unsetCodes = implode(';', collection(['49'])->toArray());



        return sprintf(terminal()->getCsi() . '%sm', $setCodes) . $value . sprintf(terminal()->getCsi() . '%sm', $unsetCodes);
<?php     public function applyBackgroundColor(string $value, string $color): string

    {

        $setCodes   = implode(';', collection($this->parseColor($color, true))->toArray());

        $unsetCodes = implode(';', collection(['49'])->toArray());



        return sprintf(terminal()->getCsi() . '%sm', $setCodes) . $value . sprintf(terminal()->getCsi() . '%sm', $unsetCodes);

    }
<?php             return ($background ? '10' : '9') . self::BRIGHT_COLORS[$color];

        }



        throw new InvalidArgumentException(sprintf('Invalid "%s" color; expected one of (%s).', $color, implode(', ', array_merge(array_keys(self::COLORS), array_keys(self::BRIGHT_COLORS)))));

    }