Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>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.</p> <p>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.</p> <p>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.</p> <p><strong>Very easy and would save you a lot of time</strong></p> <p>Let me know if you need help with the JS</p> <p><strong>Update</strong></p> <p>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).</p> <p><a href="http://www.nouilles.info/keyboard_shortcuts.html" rel="nofollow">http://www.nouilles.info/keyboard_shortcuts.html</a></p> <p><strong>Update 2</strong></p> <p>What you will need to do is apply a condition to determine which array to use.</p> <p>Set up the array like this:</p> <pre><code>$keystrokes = array( 'mac'=&gt;array( // For mac users 'english-us'=&gt;array( 'character'=&gt;3 ) ), 'windows'=&gt;array( // For windows users 'english-uk'=&gt;array( 'character'=&gt;2 ) ) ); </code></pre> <p>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.</p> <p><strong>Please note:</strong> 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.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload