Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • PHP Tutorial
  • PHP Exercises
  • PHP Array
  • PHP String
  • PHP Calendar
  • PHP Filesystem
  • PHP Math
  • PHP Programs
  • PHP Array Programs
  • PHP String Programs
  • PHP Interview Questions
  • PHP GMP
  • PHP IntlChar
  • PHP Image Processing
  • PHP DsSet
  • PHP DsMap
  • PHP Formatter
  • Web Technology
Open In App
Next Article:
PHP | IntlChar::charAge() Function
Next article icon

PHP | IntlChar::charDigitValue() Function

Last Updated : 09 Feb, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

The IntlChar::charDigitValue() function is an inbuilt function in PHP which is used to return the decimal digit value from a decimal digit character. Where the general category decimal digit numbers and “Nd” is Numeric_Type of Decimal.
Syntax: 
 

int IntlChar::charDigitValue( $codepoint )


Parameters: This function accepts a single parameter $codepoint which is mandatory. The input parameter is a character or integer value, which is encoded as a UTF-8 string.
Return Value: If $codepoint is decimal digit value then returns True otherwise return -1. 
Below programs illustrate the IntlChar::charDigitValue() Function in PHP.
Program 1: 
 

php

<?php
// PHP code to illustrate IntlChar::charDigitValue
// function
  
//Input int codepoint value
var_dump(IntlChar::charDigitValue("\u{2025}"));
echo "<br>";
  
//Input character codepoint value
var_dump(IntlChar::charDigitValue("2345"));
echo "<br>";
  
//Input int codepoint value
var_dump(IntlChar::charDigitValue("\u{0774}"));
echo "<br>";
  
//Input int codepoint value
var_dump(IntlChar::charDigitValue("2"));
echo "<br>";
  
//Input character codepoint value
var_dump(IntlChar::charDigitValue("Geeks"));
echo "<br>";
  
//Input character codepoint value
var_dump(IntlChar::charDigitValue("\u{0E66}"));
echo "<br>";
  
//Input Empty codepoint value
var_dump(IntlChar::charDigitValue(" "));
  
?>
                      
                       

Output: 
 

int(-1)  NULL int(-1)  int(2)  NULL  int(-1)  int(-1)


Program 2:
 

php

<?php
// PHP code to illustrate
// IntlChar::charDigitValue() function
     
// Declare an array $arr
$arr = array("^", "2345", "6", "\n");
 
// Loop run for every array element
foreach ($arr as $val){
     
    // Check each element as code point data
    var_dump(IntlChar::charDigitValue($val));
    echo "<br>";
}
?>
                      
                       

Output: 
 

int(-1) NULL int(6) int(-1)


Related Articles: 
 

  • IntlChar::isalpha() Function
  • IntlChar::isbase() Function
  • IntlChar::isblank() Function
  • IntlChar::iscntrl() Function


Reference: http://php.net/manual/en/intlchar.chardigitvalue.php
 



Next Article
PHP | IntlChar::charAge() Function
author
jit_t
Improve
Article Tags :
  • PHP
  • Web Technologies
  • PHP-function
  • PHP-Intl

Similar Reads

  • PHP | IntlChar digit() function
    The IntlChar::digit() function is an inbuilt function in PHP which is used to get the decimal digit value of a code point for a given radix. This function returns the decimal digit value of the code point in the specified radix. Syntax: int IntlChar::digit( $codepoint, $radix ) Parameters: This func
    2 min read
  • PHP | IntlChar::charAge() Function
    The IntlChar::charAge() function is an inbuilt function in PHP which is used to calculate the age of code point. Where the age is Unicode version when the code point was first designated or assigned a character. This can be useful to avoid emitting code points to receiving processes that do not acce
    2 min read
  • PHP IntlChar::charName() Function
    PHP IntlChar::charName() function is an inbuilt function in PHP used to retrieve the name of a Unicode character. Syntax: string IntlChar::charName( $codepoint [, $nameChoice = IntlChar::UNICODE_CHAR_NAME] ) Parameters: This function accepts two parameters as mentioned above and described below: $co
    2 min read
  • PHP | IntlChar::forDigit() Function
    The IntlChar::forDigit() function is an inbuilt function in PHP which is used to determines the character representation for a specific digit in the specified radix. Syntax: int IntlChar::forDigit( $digit, $radix ) Parameters: This function accepts two parameters as mentioned above and described bel
    2 min read
  • PHP | IntlChar charType() Function
    The IntlChar::charType() function is an inbuilt function in PHP which is used to get the general category value for a code point. This function returns the general category value for the code point. Syntax: int IntlChar::charType ( $codepoint ) Parameters: This function accepts a single parameter $c
    2 min read
  • PHP | IntlChar::chr() Function
    The IntlChar::chr() function is an inbuilt function in PHP which is used to check whether the given input character is Unicode code point value or not. It returns Unicode character by code point value.Syntax: string IntlChar::chr( $codepoint ) Parameters: This function accepts a single parameter $co
    2 min read
  • PHP | IntlChar charDirection() Function
    The IntlChar::charDirection() function is an inbuilt function in PHP which is used to get the bidirectional category value for a code point. It returns the bidirectional category value for the code point, which is used in the Unicode bidirectional algorithm. Syntax: int IntlChar::charDirection ( $co
    2 min read
  • PHP | IntlChar charFromName() Function
    The IntlChar::charFromName() function is an inbuilt function in PHP which is used to find Unicode character by name and returns the code point value. If Unicode character name does not match to a code point, then it returns NULL. Syntax: int IntlChar::charFromName( $characterName, $nameChoice = Intl
    2 min read
  • PHP | IntlChar::charMirror() Function
    The IntlChar::charMirror() function is an inbuilt function in PHP which is used to find the "mirror-image" character from the given input code point character, which maps the specified character. Syntax: mixed IntlChar::charMirror( $codepoint ) Parameters: This function accepts a single parameter $c
    2 min read
  • PHP | IntlChar enumCharNames() Function
    The IntlChar::enumCharNames() function is an inbuilt function in PHP which is used to give a catalog of all the assigned Unicode characters that are available within a range. The list will have the Unicode characters that are available between the start code points (start inclusive) and the limit co
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences