Category Archives: PHP Solutions

Adding Google Adsense Code Between Topics in phpBB

You can often see it even on popular forums. Google Adsense or any other ad code is inserted between posts or looks like a usual post. How do they do that? I will show you how to add Adsense code after first post and I hope you will be able to figure out how to do it to… Read More »

How to Use Another IP for cURL Requests

Recently I have had the problem with e-gold automation. E-gold server refused to accept my IP for an unknown reason. I had to send some payments so I triple checked the code, tried different solutions before I got the Idea to try this code from another server IP. This worked and I was happy that my server came… Read More »

Easiest Way To Sort Strings From a File By Alphabet with PHP

Today I won’t write many letters, I’ll show a simple code that allows to sort file contents by alphabet. <? // Getting file into array $stroki=file(“unsorted.txt”); //Sorting it without keys – we don’t need them sort($stroki); // Writing sorted strings to a new file $fs=fopen(“./sorted.txt”, “a”); foreach ($stroki as $string) { fwrite($fs, trim($string).”rn”); } fclose ($fs); echo “Completed”;… Read More »

Finding Difference Between Two Files with PHP

Today I will show you a short and effective solution to “minus” one file from another. The first solution uses PHP’s array_diff function and is useful when your files are not too big as this method consumes server RAM if you create big arrays. Here is the code: <? $file1=file(“plus.txt”); $file2=file(“minus.txt”); $hopa=array_diff($file1, $file2); ?> $hopa is the array… Read More »