[Solved] Recursive function doesn’t return [duplicate]


Use return here, Change this

if (substr($randomString, 0, 1) != 2) { // if doesn't start with 2
  generateRandomString($length, $alpha, $numeric); // try again
}

to

if (substr($randomString, 0, 1) != 2) { // if doesn't start with 2
 return generateRandomString($length, $alpha, $numeric); // try again
}

1

solved Recursive function doesn’t return [duplicate]