Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,154,739 members, 7,824,119 topics. Date: Friday, 10 May 2024 at 11:36 PM

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

Nairaland Forum / Science/Technology / Programming / Getting This Error In PHP Scripts Please Any Help? (416 Views)

Encountering This Error In Django: TypeError: 'module' Object Is Not Iterable / I Keep Getting This Error Message "Gradle Project Syn Failed... / Needs A %50 Percent Ponzi Script..workling Scripts Please (2) (3) (4)

(1) (Reply) (Go Down)

Getting This Error In PHP Scripts Please Any Help? by Premiumwriter: 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: 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)

Need Advice To Become A Frontend Engineer / Why Do New Businesses Need The Support Of Web Development Companies? / Flutter Developers, Let's Connect!

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 16
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.