-
$variable{$var2} ???
Hi all!
does anybody have an idea what the syntax on the 3rd line has to mean?
It's a part of a email address obfuscation function:
PHP Code:
$inprogresskey = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.@";
$ranpos = rand(0, $unshuffled - 1);
$nextchar = $inprogresskey{$ranpos};
By the way, it causes an error. (Uninitialized string offset: 0)
The whole function used to work in the past, as far as I suppressed all the PHP errors. Now I'm trying to figure out what that line was meant to be, in order to rewrite it.
thanks for your wisdom!
-
the third line act as an array of $inprogresskey variable and $ranpos creates a random number of that array.
If you test with a echo $nextchar; with a value in $unshuffled. you can see the result.
{} or [] act same in php array.
marlopax
-
Thanks!
I didn't know that {} acts the same way as []. Now I can understand the code.
Thank to your hint I was able to localized the error: a loop was calling the array just once more than it should...
Cheers,
Nominee
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|