₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,073 members, 8,420,171 topics. Date: Thursday, 04 June 2026 at 12:47 PM

Toggle theme

Getting This Error In PHP Scripts Please Any Help? - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingGetting This Error In PHP Scripts Please Any Help? (569 Views)

1 Reply (Go Down)

Getting This Error In PHP Scripts Please Any Help? by Premiumwriter(op): 2:39am On Apr 01, 2021
The line of the code giving me problem is this:

$pad = ord($text{strlen($text) - 1});


The error I got is

Fatal error: Array and string offset access syntax with curly braces is no longer supported in (then the directory of the file with the line code).

Please any help on how I can fix this?

Thanks
Re: Getting This Error In PHP Scripts Please Any Help? by stanliwise(m): 7:59am On Apr 01, 2021
Premiumwriter:
The line of the code giving me problem is this:

$pad = ord($text{strlen($text) - 1});


The error I got is

Fatal error: Array and string offset access syntax with curly braces is no longer supported in (then the directory of the file with the line code).

Please any help on how I can fix this?

Thanks
Please explain what $text means.

If $text is an array then do

$text[] rather than $text{}
Re: Getting This Error In PHP Scripts Please Any Help? by Premiumwriter(op): 9:35am On Apr 02, 2021
stanliwise:
Please explain what $text means.

If $text is an array then do

$text[] rather than $text{}
I changed the {} to [] but the code stopped loading.

i have attached a screenshot for you to see.

the first screenshot is the original one while the second screenshot is the one i made the changes as you suggested and it stopped responding.
line 167

fnep2smooth

Re: Getting This Error In PHP Scripts Please Any Help? by stanliwise(m): 10:32pm On Apr 02, 2021
Premiumwriter:
I changed the {} to [] but the code stopped loading.

i have attached a screenshot for you to see.

the first screenshot is the original one while the second screenshot is the one i made the changes as you suggested and it stopped responding.
line 167

fnep2smooth
The problem here now is that your screenshot does not tell what type of data we are expecting $text to be, should it be
array?
string?
integer?
object?

meanwhile ord by nature receives a character as an argument. so my conclusion would be this
ord($text[strlen($text) - 1)]);

The above should be the correct pattern
1 Reply

Encountering This Error In Django: TypeError: 'module' Object Is Not IterableWho Can Decipher This Error For Me?I Keep Getting This Error Message "Gradle Project Syn Failed...234

How To Upgrade NairalandThe Best Microsoft's SQL. Server Course On UdemyHow To Find The Right Development Firm To Convert PSD To Shopify?