[Chartjs]-How to generate color code dynamically by swapping 2 characters within a string using PHP

3👍

You can use index to access a char of string like access an array. Check the live demo.

<?php
$color="3BD1E9";
$temp = $color[4];
$color[4] = $color[3];
$color[3] = $temp;
echo $color;

Leave a comment