php

Php write file as file,file2,file3 etc

<?php $name = 'folder/file.txt'; $actual_name = pathinfo($name,PATHINFO_FILENAME); $original_name = $actual_name; $extension = pathinfo($name, [...]

3 Nifty Tips & Tricks to Optimize Your PHP…

Every once in a while it helps to visit your coding habits and see if there are areas that can be improved upon. For some programmers, this could mean a [...]

Why shouldn’t I use mysql_* functions in PHP?

What are the technical reasons why I shouldn't use mysql_* functions? (e.g. mysql_query(), mysql_connect() or mysql_real_escape_string())? Why should I use [...]

Reference – What does this error mean in PHP?

What is this? This is a number of answers about warnings, errors and notices you might encounter while programming PHP and have no clue how to fix. This is [...]

What are Long-Polling, Websockets, Server-Sent Events (SSE) and Comet?

I have tried reading some articles, but I am not very clear on the concepts yet. Would someone like to take a shot at explaining to me what these technologies [...]

How does ‘foreach’ actually work?

Let me prefix this by saying that I know what foreach is, does and how to use it. This question concerns how it works under the bonnet, and I don't want any [...]

How to fix “Headers already sent” error in PHP

When running my script, I am getting several errors like this: Warning: Cannot modify header information - headers already sent by (output started at [...]

How do you use bcrypt for hashing passwords in PHP?

Every now and then I hear the advice "Use bcrypt for storing passwords in PHP, bcrypt rules". But what is bcrypt? PHP doesn't offer any such functions, [...]

Check if string contains specific words?

Consider: $a = 'How are you?'; if ($a contains 'are') echo 'true'; Suppose I have the code above, what is the correct way to write the statement if ($a [...]

Reference – What does this symbol mean in PHP?

What is this? This is a collection of questions that come up every now and then about syntax in PHP. This is also a Community Wiki, so everyone is invited to [...]