I’ve been trying to accomplish this, but as other issues I just can’t figured it out. I’ve been reading around for posibles solutions but non of them goes along with my code, or if they do I can’t figure out how or where to use them. I have a DB where a user sends records. The database…
Tag: php
php explode and force array keys to start from 1 and not 0
I have a string that will be exploded to get an array, and as we know, the output array key will start from 0 as the key to the first element, 1 for the 2nd and so on. Now how to force that array to start from 1 and not 0? It’s very simple for a typed array as we
why use 0xffff over 65535
I’ve seen some PHP script which uses 0xffff in mt_rand(0, 0xffff). I do echo 0xffff; and results to 65535. Is there any significance of using this 0xffff? And also what is that?
Symfony2 Validating an optional field
In my form, I have a field with required option set to false, this field is optional. However, I would like to have a notBlank validation on this field when the field is used: Right now, I can’t use the validation constraint NotBlank because it will cause my form validation to fail when the field is unu…
Generate BIC from IBAN bank account number
Is there any existing library or script I can use to generate the BIC code from an IBAN bank account number (and other necessary information)? I’ve searched the web, but found only IBAN generators. Thanks in advance! Answer Solution for Belgian IBAN bank account numbers: There exists a webservice for Be…
How to programmatically find public properties of a class from inside one of it’s methods
I’ve got a class Foo with public and protected properties. Foo needs to have a non-static method, getPublicVars() that returns a list of all the public properties of Foo (this is just an example, I know from outside the Foo object calling get_object_vars() will accomplish this and there is no need for m…
WordPress localhost ftp
I have wordpress running on my localhost on mac Lion. Everytime I try to install or delete plugins it asks me for hostname, ftp username and ftp password. I configured my localhost to 127.0.0.1, but …
Matching all three kinds of PHP comments with a regular expression
I need to match all three types of comments that PHP might have: # Single line comment // Single line comment /* Multi-line comments */ Something I should mention: I am doing this in order to be able to recognize if a PHP closing tag (?>) is inside a comment or not. If it is then ignore it, and
Google Calendar API PHP listEvents not retrieving all events
i am trying to retrieve ALL of the events using the Google_CalendarService. So far I am retrieving everything with recuring events, but there are some events that don’t show up. Example: I have …
PHP number abbreviator
Edit: Function below now does the abbreviation correctly, implemented @Asad ‘s solution Hi I am currently working on a like button, I’ve got all the base functionality working nicely however I have started the number abbreviation code and hit a wall as I can’t figure out how to make the abbr…