Answers for "php add number to the existing name"

PHP
0

php add number to the existing name

$name = 'foo';
$first_name = $name;
$i = 0;
do {
  //Check in the database here
  $exists = exists_in_database($name);
  if($exists) {
    $i++;
    $name = $first_name . $i;
  }
}while($exists);
//save $name
Posted by: Guest on September-24-2020

Code answers related to "php add number to the existing name"

Browse Popular Code Answers by Language