trouble understading arrays in PHP
14:40 28 Dec 2025

i'm new here and programming in general. Currently I'm having trouble around array functions.i have this:

$sql='SELECT link FROM links';  
$result=mysqli_query($connect,$sql);    
$links=mysqli_fetch_all($result,MYSQLI_ASSOC);  
print '
';  
Print_r ($links)
;$rand = array_rand($links,1);
echo $rand;

which will select a random value out of the Db.

the result i get is

[0] => Array ( [link] => vANfY96ccOY )

the " echo $rand "

will throw a random number instead the string . what do i need to do get only the string and not random numbers or this

: [5] => Array([link] => WGuyxGJW9hs)

just the WGuyxGJW9hs as a random query result

Thank You happy holidays

php