Closed KRens closed 2 years ago
Thanks for the feedback! That code was built before the combined lists were available...I'll think of something but for now I'll leave it like that
...also the combined lists in PHP are broken, I am just noticing that now
Ok, point 1 to 3 are quick fixes for you, I got it working without the combined one for now.
Point 4: ok, clear, something for the future.
Your commit did not fix point number 3 ;-)
it works for me on PHP 7.3.19 what version are you using?
the PHP files that I have don't have a variable name in them and look like this
<?php return array(
4 => array('id' => 4 , 'alpha2' => 'af', 'alpha3' => 'afg', 'name' => 'Afghanistan'),
8 => array('id' => 8 , 'alpha2' => 'al', 'alpha3' => 'alb', 'name' => 'Albania'),
i fixed the combined lists in PHP - as in, they now work instead of being broken. the function in the readme.md still doesn't apply for the combined data
I added a note in the README.md highlighting the fact that the functions work for the non-combined data sets
thanks for your feedback!
$countries = require 'path/to/countries.php'; doesn't work for me. require 'path/to/countries.php'; does
This since the php file file already contains "$countries = array(" and puts it in the correct variable.
I'm using PHP 7.4.26
the php file does not contain $countries = array(
you must be using an older version
ah, i see now - i don't yet have a release with the updates done to the PHP files - my bad
this is a change suggested in #58 and which has been already implemented
i just published a new release and it is now available via npm and packagist
In the readme.md there are a few error's causing error's in the code.
search_county(array('id' => 250}); search_county(array('alpha2' => 'fr'}); search_county(array('alpha3' => 'fra'});
=> 1) This should be search_country instead of county! 2) This should be )); instead of }); 3) $countries = require 'path/to/countries.php'; does not work, you need just require 'path/to/countries.php'; This one already creates the $countries variable. 4) Your sample code does not seem to work with the _combined file.
The sample php code also does not work, I get following error: Fatal error: Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, int given in C:\xampp\htdocs\account.php:214 Stack trace: #0 C:\xampp\htdocs\account.php(214): array_filter(1, Object(Closure)) #1 C:\xampp\htdocs\account.php(222): search_country(Array) #2 {main} thrown in C:\xampp\htdocs\account.php on line 214
I tried both loading the _combined as the language specific file, neither solves the issue. /vendor/stefangabos/world_countries/data/countries/en/countries.php