briancray / PHP-URL-Shortener

577 stars 216 forks source link

after php 5.4 have error "String offset cast occurred" #22

Closed dejurin closed 7 years ago

dejurin commented 7 years ago

$length = strlen($base); while($integer > $length - 1) { $out = $base[fmod($integer, $length)] . $out; $integer = floor( $integer / $length ); } return $base[$integer] . $out;

replace

$length = strlen($base); while($integer > $length - 1) { $out = $base[(int) fmod($integer, $length)] . $out; $integer = floor( $integer / $length ); } return $base[(int) $integer] . $out;