Unstoppable Domains

[PHP] Scalar value as an array ?

Spaceship Spaceship
Watch

xrvel

i love automationVIP Member
Impact
165
I got this warning when i run a script on a web server (it works well on my other server). I do not know if this is caused by the server environment or something else.

Code:
Warning: Cannot use a scalar value as an array

Here is the line
PHP:
$name{$j} = charAt($charSets[$j]['sets'], $pos);
Note:
$name is a string.
$charSets is an array
$j and $pos is an integer
charAt is a custom function.

How to fix this warning (actually although it is a warning, it causes an error in my script)?

- Kurniawan.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
I'm unfamiliar with the $var{$another_var} notation in PHP. What is that?
 
0
•••
mholt said:
I'm unfamiliar with the $var{$another_var} notation in PHP. What is that?
Its for getting a character in a position. $name{0} means first character in $name (string).
On the example, i want to set a character in a position in $name, into other character.
 
0
•••
Woah, weird. I can't believe I never knew that. I always thought [$index] was the notation, not {$index}.

Oh well. That's cool.

In regards to your question, I found this post on another forum:

i had $usergroups = 0; somewhere else.
so i guess i was trying to overflow the memory buffer

You might find this helpful too.

Good luck!
 
1
•••
Thank you for the link. Its very useful :tu:
I guess my variable does not converted into an array correctly, i will recheck my code :)
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99
Appraise.net

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back