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 getNumericValue() Function
Next article icon

PHP | IntlChar getBlockCode() Function

Last Updated : 04 Nov, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report

The IntlChar::getBlockCode() function is an inbuilt function in PHP which is used to get the Unicode allocation block containing the code point. This function returns the Unicode allocation block that contains the character. 

Syntax: 

int IntlChar::getBlockCode ( $codepoint ) 

Parameters: This function accepts a single parameter $codepoint which is mandatory. The $codepoint value is an integer values or character, which is encoded as a UTF-8 string.

Return Value: This function returns the block value for $codepoint. Some block value of codepoint are listed below: 

  • IntlChar::BLOCK_CODE_BASIC_LATIN
  • IntlChar::BLOCK_CODE_GREEK
  • IntlChar::BLOCK_CODE_MISCELLANEOUS_SYMBOLS

Below programs illustrate the IntlChar::getBlockCode() function in PHP:

Program 1:  

PHP




<?php
 
// PHP function to illustrate
// the use of IntlChar::getBlockCode()
 
// Input data is character type
var_dump(IntlChar::getBlockCode("G") ===
          IntlChar::BLOCK_CODE_BASIC_LATIN);
 
// Input data is string type
var_dump(IntlChar::getBlockCode("ABC") ===
          IntlChar::BLOCK_CODE_BASIC_LATIN);
 
// Input data is character type
var_dump(IntlChar::getBlockCode("*") ===
               IntlChar::BLOCK_CODE_GREEK);
 
// Input data is unicode character type
var_dump(IntlChar::getBlockCode("\u{2603}") ===
     IntlChar::BLOCK_CODE_MISCELLANEOUS_SYMBOLS);
 
// Input data is character type
var_dump(IntlChar::getBlockCode("@") ===
                     IntlChar::BLOCK_CODE_GREEK);
?>
 
 
Output: 
bool(true) bool(false) bool(false) bool(true) bool(false)       

 

Program 2: 

PHP




<?php
// PHP code to illustrate IntlChar::getBlockCode()
      
// Declare an array $arr
$arr = array("G", "GeeksforGeeks", "^", "1001", "6", "\n");
     
// Loop run for every array element
foreach ($arr as $val){
         
    // Check each element as code point data
    var_dump(IntlChar::getBlockCode($val));
}
?>
 
 
Output: 
int(1) NULL int(1) NULL int(1) int(1)       

 

Related Articles: 

  • PHP | IntlChar::iscntrl() Function
  • PHP | IntlChar::totitle() Function
  • PHP | IntlChar charType() Function

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



Next Article
PHP | IntlChar getNumericValue() Function

V

vijay_raj
Improve
Article Tags :
  • PHP
  • Web Technologies
  • PHP-function
  • PHP-Intl

Similar Reads

  • PHP | IntlCalendar getErrorCode() Function
    The IntlCalendar::getErrorCode() function is an inbuilt function in PHP which returns the numeric ICU error code for the last call on this object or the IntlCalendar given for the calendar parameter. This function can indicate a warning message (negative error code) or no error. Syntax: Object orien
    1 min read
  • PHP | IntlChar getUnicodeVersion() Function
    The IntlChar::getUnicodeVersion() function is an inbuilt function in PHP which is used to get the Unicode version. The Unicode standard version information is filled into an array. For example, Unicode version 2.2.1 is represented as an array with the values [2, 2, 1, 0]. Syntax: array IntlChar::get
    1 min read
  • PHP | IntlChar getNumericValue() Function
    The IntlChar::getNumericValue() function is an inbuilt function in PHP which is used to get the numeric value for a Unicode code point as defined in the Unicode Character Database. Syntax: float IntlChar::getNumericValue( $codepoint ) Parameters: This function accepts a single parameter $codepoint w
    2 min read
  • PHP | IntlChar getBidiPairedBracket() Function
    The IntlChar::getBidiPairedBracket() function is an inbuilt function in PHP which is used to get the paired bracket character for a code point. This function mapped with paired bracket. If the character has no pair bracket then it returns the character itself. Syntax: IntlChar::getBidiPairedBracket
    2 min read
  • PHP | IntlChar getPropertyEnum() Function
    The IntlChar::getPropertyEnum() function is an inbuilt function in PHP which is used to get the property constant value for a given property name. The property name is going to be specified in PropertyAliases.txt, which is a Unicode Database file. All types of variants are recognized in this, be it
    2 min read
  • PHP | IntlChar getPropertyName() Function
    The IntlChar::getPropertyName() function is an inbuilt function in PHP which is used to get the Unicode name for a given property which is given in the Unicode database file PropertyAliases.txt. This function maps the property IntlChar::PROPERTY_GENERAL_CATEGORY_MASK to the synthetic names "gcm" / "
    2 min read
  • PHP | IntlCalendar get() Function
    The IntlCalendar::get() function is an inbuilt function in PHP which is used to get the value for a specific field. Syntax: Object oriented style int IntlCalendar::get( int $field ) Procedural style int intlcal_get( IntlCalendar $cal, int $field ) Parameters: This function uses two parameters as men
    2 min read
  • PHP | IntlCalendar getTime() Function
    The IntlCalendar::getTime() function is an inbuilt function in PHP which is used to return the time currently represented by the object. The time is expressed in terms of milliseconds since the epoch. Syntax: Object oriented style float IntlCalendar::getTime( void ) Procedural style float intlcal_ge
    1 min read
  • PHP | IntlChar getCombiningClass() Function
    The IntlChar::getCombiningClass() function is an inbuilt function in PHP which is used to get the combining class of the code point.Syntax: int IntlChar::getCombiningClass ( $codepoint ) Parameters: This function accepts a single parameter $codepoint which is mandatory. The $codepoint value is an in
    1 min read
  • PHP | IntlDateFormatter getErrorCode() Function,
    The IntlDateFormatter::getErrorCode() function is an inbuilt function in PHP which is used to return the error code from last operation. Syntax: Object-oriented style: int IntlDateFormatter::getErrorCode( void ) Procedural style: int datefmt_get_error_code( IntlDateFormatter $fmt ) Parameters: This
    1 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