Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Question

Active reading.
Source Link
Peter Mortensen
  • 31.3k
  • 22
  • 110
  • 134

I'm trying to create a randomized string in PHP, and I get absolutely no output with this:

<?php
function RandomString()
{
 $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
 $randstring = '';
 for ($i = 0; $i < 10; $i++) {
 $randstring = $characters[rand(0, strlen($characters))];
 }
 return $randstring;
}
RandomString();
echo $randstring;

What am I doing wrong?

I'm trying to create a randomized string in PHP, and I get absolutely no output with this:

<?php
function RandomString()
{
 $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
 $randstring = '';
 for ($i = 0; $i < 10; $i++) {
 $randstring = $characters[rand(0, strlen($characters))];
 }
 return $randstring;
}
RandomString();
echo $randstring;

What am I doing wrong?

I'm trying to create a randomized string in PHP, and I get absolutely no output with this:

<?php
function RandomString()
{
 $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
 $randstring = '';
 for ($i = 0; $i < 10; $i++) {
 $randstring = $characters[rand(0, strlen($characters))];
 }
 return $randstring;
}
RandomString();
echo $randstring;

What am I doing wrong?

edited body
Source Link
Yogesh Suthar
  • 30.5k
  • 18
  • 75
  • 100

I'm trying to create a randomized string in PHP, and I get absolutely no output with this:

<?php
function RandomString()
{
 $characters = ’0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ’;'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
 $randstring = '';
 for ($i = 0; $i < 10; $i++) {
 $randstring = $characters[rand(0, strlen($characters))];
 }
 return $randstring;
}
RandomString();
echo $randstring;

What am I doing wrong?

I'm trying to create a randomized string in PHP, and I get absolutely no output with this:

<?php
function RandomString()
{
 $characters = ’0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ’;
 $randstring = '';
 for ($i = 0; $i < 10; $i++) {
 $randstring = $characters[rand(0, strlen($characters))];
 }
 return $randstring;
}
RandomString();
echo $randstring;

What am I doing wrong?

I'm trying to create a randomized string in PHP, and I get absolutely no output with this:

<?php
function RandomString()
{
 $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
 $randstring = '';
 for ($i = 0; $i < 10; $i++) {
 $randstring = $characters[rand(0, strlen($characters))];
 }
 return $randstring;
}
RandomString();
echo $randstring;

What am I doing wrong?

deleted 6 characters in body
Source Link
Timo Tijhof
  • 10.4k
  • 6
  • 38
  • 53

I'm trying to create a randomized string in PHP, and I get absolutely no output with this:

<?php
function RandomString()
{
 $characters = ’0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ’;
 $randstring = '';
 for ($i = 0; $i < 10; $i++) {
 $randstring = $characters[rand(0, strlen($characters))];
 }
 return $randstring;
}
RandomString();
echo $randstring;
?>

What am I doing wrong?

I'm trying to create a randomized string in PHP, and I get absolutely no output with this:

<?php
function RandomString()
{
 $characters = ’0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ’;
 $randstring = '';
 for ($i = 0; $i < 10; $i++) {
 $randstring = $characters[rand(0, strlen($characters))];
 }
 return $randstring;
}
RandomString();
echo $randstring;
?>

What am I doing wrong?

I'm trying to create a randomized string in PHP, and I get absolutely no output with this:

<?php
function RandomString()
{
 $characters = ’0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ’;
 $randstring = '';
 for ($i = 0; $i < 10; $i++) {
 $randstring = $characters[rand(0, strlen($characters))];
 }
 return $randstring;
}
RandomString();
echo $randstring;

What am I doing wrong?

Loading
Question Protected by animuson
PHP not PhP
Source Link
BoltClock
  • 728.6k
  • 165
  • 1.4k
  • 1.4k
Loading
Source Link
Captain Lightning
  • 10.8k
  • 4
  • 22
  • 17
Loading
lang-php

AltStyle によって変換されたページ (->オリジナル) /