Skip to content

Tag: php

Match a PHP class with a Regular Expression

I wanna catch Php classes from a file: and the result matches must be and Answer regexps are poor at parsing programming languages’ grammars. Consider tokenizer functions instead. e.g. http://php.net/manual/en/function.token-get-all.php see also this http://framework.zend.com/apidoc/core/Zend_Reflection…

array replace function not working for me

is there any array replace function in php .. in php manual there is a function called array_replace but its not working… Tell me some example… for array replace.. Answer output the question is: what exactly isnt working for you?

preg_match() and username

Easy one.., i have this, can you explain what it checks for? I know it checks if the username have length between 2-20, what more? Thanks Answer It searches for text containing only alphanumeric and underscore characters, from 2 to 20 characters long. /^[a-zd_]{2,20}$/i |||| | ||| ||| |||| | ||| ||i : case in…

Save Google map to jpeg using PHP?

Is it even possible? I am implementing an export to pdf functionality for a pile of data, one of which is a Google map with a marker. Thank you. Answer I think you are looking for this: http://code.google.com/apis/maps/documentation/staticmaps/ you just need the url and the google api returns the google maps …

How to enforce a http 403 or 404?

Is it possible to kind of force a 403 or 404 error? I have a kind of admin page, where I am trying to prevent hackers from getting into my filesystem on my server. (the path get’s delivered over the …