Answer the question
In order to leave comments, you need to log in
How to get rid of string() in an array?
The script from the folder takes all files with the .json extension , if it is really .json , then removes the file extension and writes the name (of the user) to the $data['users'] array
And here a problem arose, some string() appeared in the array, here is an example response:
array(2) { [0]=> string(11) "1enderstore" [1]=> string(5) "sport" }
var_dump($data['users']);
array(2) { [0]=> "1enderstore" [1]=> "sport" }
string(23) "["1enderstore","sport"]"
Answer the question
In order to leave comments, you need to log in
Maybe I misunderstood the essence of the question, but since you display information through var_dump
, in any case it also shows the data type (in your case, string).
You can use this construct to output
echo '<pre>';
print_r( $data );
echo '</pre>'
This is the output format of var_dump with types.
php.net/manual/en/function.var-dump.php
The function displays structured information about one or more expressions, including their type and value. Arrays and objects are parsed recursively with values indented differently to visually display the structure.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question