/    Sign up×
Community /Pin to ProfileBookmark

How would I oput a random string of letters and #’s ?

Like I know I would have

$string=”a b c d e f g h i j k l m n o p q r s t u v w x y z”;
$array=explode(” “,$string);

but how would I output 5 random characters from that array

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@96turnerriJul 25.2004 — [code=php]
<?php

$string = "a b c d e f g h i j k l m n o p q r s t u v w x y z";
$array = explode(" ",$string);
$rand_keys = array_rand($array, 5);
$pass = $array[$rand_keys[0]] . $array[$rand_keys[1]] . $array[$rand_keys[2]] . $array[$rand_keys[3]] . $array[$rand_keys[4]];
echo $pass;

?>
[/code]
×

Success!

Help @Conor spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...