Gender PHP extension is “gender.c” part program written by Joerg Michael. PHP gender extension finds gender from first names using gender database contains > 40000 first names for 54 countries.


>> CentOS Linux release 7.4.1708 (Core)


With PHP 7.2

# yum --enablerepo=remi install php72-php-pecl-gender


We are using Nginx with PHP 7.2


Let's have a check with existing files 

# ll /etc/opt/remi/php72/php.d/40-gender.ini
# vi /etc/php.d/40-gender.ini


>> 40-gender.ini

; Enable Gender extension module



# service nginx restart
# systemctl restart php-fpm.service


With PHP 5.6

# yum --enablerepo=remi,remi-php56 install php-pecl-gender


Let's have a check with existing files 

# ll /usr/lib64/php-zts/modules/
# ll /usr/lib64/php/modules/


Make file



>> gender.ini

; Enable gender extension module


Examples for INDIAN Names
<?php use Gender\Gender; $gender = new Gender(); printf("Arjun is %s\n",     $gender->get('Arjun', Gender::INDIAN ) == Gender::IS_MALE   ? 'Male'     : 'Not male'); // prints Arjun is Male printf("Anjali is %s\n",      $gender->get('Anjali', Gender::INDIAN ) == Gender::IS_FEMALE     ? 'Female'   : 'Not female'); // prints Anjali is Female ?>


Arjun is Male Anjali is Female


Was this answer helpful? 0 Users Found This Useful (0 Votes)