PHP string length

PHP coding standards say:

... PHP contains the length property of each line, and should not be evaluated using strlen (). Write your functions in such a way that they can use the length property both for efficiency and for ensuring their binary security ....

How can I access this length property? Or am I misunderstanding?

+3
source share
4 answers

As Ignacio mentioned in another post :

They talk about the C function, not the PHP function. The function will no longer be considered after the first \ 0, but PHP lines may contain \ 0 in a different place than the end.

, , , PHP-, PHP.

+4

- PHP, PHP.

PHP C, strlen, , C, PHP.

+2

This is not a โ€œpropertyโ€ in the sense that it will be in other languages โ€‹โ€‹(for example, C #).

You cannot do:   myString.Length;

Instead, you will need:   strlen(myString);

0
source
$string = "foobar";
$l = strlen($foobar);
echo $l;
//echos 6
-1
source

All Articles