Multiple choice technology web technology

  1. When you need to obtain the ASCII value of a character which of the following function you apply in PHP?

  1. chr( );

  2. asc( );

  3. ord( );

  4. val( );

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The ord() function in PHP returns the ASCII value of a single character. For example, ord('A') returns 65. Option A, chr(), does the opposite - converts an ASCII value to a character. Option B, asc(), is not a PHP function (it exists in some other languages). Option D, val() is not a standard PHP function for ASCII conversion. The function name 'ord' relates to 'ordinal' value in character encoding systems.