Let's see what this code is about.

Source: Internet
Author: User
Let's see what's wrong with this code.
 
  
$count = 123456789;

$str 1 = $str [Floor (Floor (Floor ($count/26)/26)/26)/26)/26)];
$str 2 = $str [Floor (Floor (Floor ($count/26)/26)/26)/26)%26];
$str 3 = $str [Floor (Floor ($count/26)/26)/26)%26];
$str 4 = $str [Floor (Floor ($count/26)/26)%26];
$str 5 = $str [Floor ($count/26)%26];
$str 6 = $str [$count%26];
echo $str 1. '
';
echo $str 2. '
';
echo $str 3. '
';
echo $str 4. '
';
echo $str 5. '
';
echo $str 6. '
';

?>

Report this error: Notice:string offset cast occurred in E:\www\rand.php on line 5

Share to:


------Solution--------------------
Check it out.
$n = Floor (Floor (Floor ($count/26)/26)/26)/26)/26);
Var_dump ($n);
Float (10)

The subscript should be an integral number, so
$str 1 = $str [Floor (Floor (Floor ($count/26)/26)/26)/26)/26)];
Should write
$str 1 = $str [Intval (Floor (Floor (Floor ($count/26)/26)/26)/26)/26)];

------Solution--------------------
References: Check it out.
$n = Floor (Floor (Floor ($count/26)/26)/26)/26)/26);
Var_dump ($n);
Float (10)

The subscript should be an integral number, so
$str 1 = $str [Floor (Floor (Floor ($count/26)/26)/26)/26)/26)];
Should write
$str 1 = $str [Intval (Floor (Floor (Floor ($count/26)/26)/26)/26)/26)];


Moderator powerful ha, I do not know from where to hand
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.