Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #add #number #existing
ADD COMMENT
Topic
Name
8+2 =