Is it possible to set the PHP version value, say 4.0+ and have PHPStorm highlight functions that wouldn’t work with the oldest version? For example, for PHP4 this should highlight static function etc. I have a PHP installation on my PC but I don’t want to install an older PHP version for every sma…
multiple buttons on a form
I have a clear button that I want to tie into some php coding. how do I detect if the clear button is pressed. When the user press clear, i’m going to have it update a sql table to clear out entries. …
A numeric string as array key in PHP
Is it possible to use a numeric string like “123” as a key in a PHP array, without it being converted to an integer? $blah = array(‘123’ => 1); var_dump($blah); prints array(1) { [123]=> …
What’s the fastest way to find and replace in PHP?
I need a way of replacing some variables within a passed string. Example: I pass through “#fname# jumped over the tall wall to get his phone with the number #phone#”. I need the string to be …
PHP + FTP delete files in folder
I just wrote a PHP Script which should connect to FTP and delete all files in a special folder. It looks like this, but I have no clue what command I need to delete all files in the folder logs. …
PHP parse_ini_file TC_CONSTANT warning
I’ve got a weird issue, weird as in nothing comes up on Google. I’m trying to parse an ini file full of HTTP status codes, StatusCodes.ini. I’ve tested in three different environments, locally (WAMP) on a shared host (Hostmonster.com) and now on a dedicated machine running CentOS w/ CPanel/W…
Escaping data – stripslashes, strip_tags
Why do a lot of people use both these functions on a string? I see a lot of stripslashes(strip_tags($field)); (or the other way around) Isn’t strip_tags enough to filter any xss stuff and such things? Answer Escaping data has nothing to do with strip_tags or stripslashes. These functions filter certain …
How to find first/second element of associative array when keys are unknown?
In PHP when you have an associative array, e.g.: $groups[‘paragraph’] = 3 $groups[‘line’] = 3 what is the syntax to access the first or second element of the array when you don’t know the value of …
What is a templating language?
I was reading somewhere that PHP is a templating language. What is exactly a templating language? What makes PHP one? What are the other templating languages?
What is PHP session_start()
Does it start a current session based on cookies? Got that from the PHP website. How does PHP control the session? If I start a session when a user opens up my login page, what do I even use that session for? Can I use the current session to get info about the logged in user? Answer The PHP session