I want Generates a random string.And my develop environment is xampp with php7.0.9. because of references a String class, I got that error.
Asked
Active
Viewed 1.5k times
4 Answers
8
is this a cakephp project on php 7, you should just download the cakephp 2.8 and copy the lib folder from it and replaced to my project.
and Problem Solved

Iyke Perry
- 341
- 4
- 2
-
Where can you download cakephp 2.8? Everything I can find involves using composer etc. and seems pretty complex when all that's needed is replacing a folder? [Update I found it here: https://github.com/Mingyangzu/cakephp-2.8.4] – Paul Feakins Mar 23 '21 at 11:33
1
String is reserved keywords. you can't use String as class names in PHP 7. change it to any other name. like Sting_type.

Mahesh Gareja
- 1,652
- 2
- 12
- 23
1
You're using a class to do this probably. However when you named this class, you named it String.
PHP and other languages have reserved terms that are for internal functions and variables only. We can't use them.
Simply change the classname to something else and it will work normally.

Nabeel Khan
- 3,715
- 2
- 24
- 37