Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7407901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:48:43+00:00 2026-05-29T05:48:43+00:00

Is there some kind of function which can calculate how many keystrokes are needed

  • 0

Is there some kind of function which can calculate how many keystrokes are needed to type a specific character?

For example in french, the character Ÿ needs 3 keystrokes to be typed. Right now I’m just checking each character against an array and add the associated value, for Ÿ it would be 3.

Is there some way in PHP to automate this or do I have to stick with the array approach?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:48:44+00:00Added an answer on May 29, 2026 at 5:48 am

    It is not possible to do this automatically as PHP is a server side script and cannot see the keyboard layout of the user, nor can it detect when a key is pressed. Therefore, your only solution would be to use a library, of which I do not believe exists.

    You will need to proceed with creating your own library (array) of keystrokes. However, you could do this much faster if you integrated a temporary javascript script.

    Make a list of all the characters you want (on paper or computer, doesn’t matter), then feed them into a webpage that picks up your key strokes using javascript. Then use javascript to add these to an array which you can copy and paste into PHP.

    Very easy and would save you a lot of time

    Let me know if you need help with the JS

    Update

    This may help you with Windows and Mac, you will need a separate array for each OS and keyboard layout (detect the keyboard layout using javascript).

    http://www.nouilles.info/keyboard_shortcuts.html

    Update 2

    What you will need to do is apply a condition to determine which array to use.

    Set up the array like this:

    $keystrokes = array(
         'mac'=>array(     // For mac users
              'english-us'=>array(
                   'character'=>3
              )
         ),
         'windows'=>array(     // For windows users
              'english-uk'=>array(
                   'character'=>2
              )
         )
    );
    

    And then have a default set for unknown layouts or OS’s. I would advise setting Windows english-us as the default set as this is what is most used around the world.

    Please note: There is no way to get this 100% accurate as there are so many different OS’s and keyboard layouts it is simply far to time consuming to cover every possible combination. You might want to ask yourself if this functionality is absolutely necessary because it seems that it will be pretty unreliable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Firstly, I was wondering if there was some kind of built in function that
Is there some kind of a shorthand fluent interface for creating a parameters dictionary
Is there some kind a engine for Json in the Zend framework, What I
Possible Duplicate: Is there a CSS parent selector? Is there some kind of .this
I was wondering if there exists some kind of indexer (in python language for
As far as I know there's some kind of Linux in the Chrome OS
I would like to know if there is some kind of special markup to
I would like to know if there is some kind of instanceof functionality in
Is there any way to do some kind of while() for each post variable
Is there a good application (that has some kind of gui) for testing memory

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.