Tag Archives: git

how to digitally sign a file in PHP

Questions: I made a user table in my DB with different columns for holding users’ info. Also I have added two columns public_key and private_key. When a user registers, his info will be inserted to the table. plus I am using: // Create the keypair $res=openssl_pkey_new(); // Get private key openssl_pkey_export($res, $privatekey); // Get public… Read More »

Generate an N-digit random number

Questions: I want to generate a 6 digit random number using the PHP mt_rand() function. I know the PHP mt_rand() function only takes 2 parameters: a minimum and a maximum value. How can I do that? Answers:

PHP: get number of decimal digits

Questions: Is there a straightforward way of determining the number of decimal places in a(n) integer/double value in PHP? (that is, without using explode) Thanks, Erwin Answers:

How do you format a 10 digit string into a phone number?

Questions: I have database records in the form of 10 character long strings, such as 4085551234. I wish to format these into this format: (408) 555-1234. I think this is regex related. I’m new to programming and completely self-taught here, so any sort of resource relating to performing text processing would be appreciated as well.… Read More »

TCPDF adding digital signature to the created pdf

Questions: I have kind of weird problem. I’m struggling with a pdf digital signature problem since a while and it did’t working as I expect. Actually it doesn’t work at all. I used exacly same code as is posted in the Examples 52 page: // set certificate file $certificate = ‘file://var/www/app/tcpdf/config/cert/tcpdf.crt’; // set additional information… Read More »

How to find nearest location using latitude and longitude from sql database?

Questions: I want to find a nearest location from following database table Address Latitude longitude Kathmandu 44600, Nepal 27.7 85.33333330000005 Los, Antoniterstraße 37.09024 -95.71289100000001 Sydney NSW, Australia 49.7480755 8.111794700000019 goa india 15.2993265 74.12399600000003 I have fetched this all data from google maps. Here i have to find nearest location from a place. Suppose i am… Read More »

Extracting digits from a cell with varying char length

Questions: I have a group of cells, the first of the string never changes, it is and always will (until the coder changes it) 20 characters (inc spaces). I then want to extract the 3 numbers (and in some cases 2) from the remaining sequence. The monthly cost is 2 silver, 1 copper and 40… Read More »