Indexing a string while copying by reference
Will this be a reason of causing an index out of bounds error?
Quote:
Shouldn't be this the proper way of using it safely? :arrow: PHP Code:
|
Re: Indexing a string inside a native will cause outbounds?
It makes sense to me. Are you possibly defining the same variable, that is sized differently, globally and locally, accidentally?
|
Re: Indexing a string inside a native will cause outbounds?
Nah its just a question out of curiosity.
Can you explain how does it make sense? For example lets say this is the body function of PHP Code:
|
Re: Indexing a string inside a native will cause outbounds?
The first one can produce an index out of bounds error since you pass the entire array size as 3rd param but the string is smaller because it is sliced.
The second one looks fine. Are you actually getting an error? What are you really asking? |
Re: Indexing a string inside a native will cause outbounds?
Quote:
Yeah i am still getting undefined crashes so its best to avoid the first example. |
Re: Indexing a string inside a native will cause outbounds?
Quote:
PHP Code:
This is the same as doing PHP Code:
|
Re: Indexing a string inside a native will cause outbounds?
Alright then problem solved crisis avoided!!!
|
Re: Indexing a string inside a native will cause outbounds?
To clarify, are you still getting the error with the second code with the subtraction? I don't see how you'd get an error with this (second code).
|
Re: Indexing a string inside a native will cause outbounds?
Quote:
|
| All times are GMT -4. The time now is 11:30. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.