Category Archives: Basic PHP

basic php theory

PHP Tutorial : Write to a file with fwrite

I showed you earlier in a older post how to open and read text contents from a file. Now it’s time to see how to write to a file using php function called fwrite(). <?php $theFileToWriteTo = “textFile.txt”; $fileHandle = … Continue reading

Posted in Basic PHP | Tagged , , , , | 1 Comment

PHP Tutorial : Multiple string replace with str_replace

Well, I already writed about str_replace php function but this tip is very usefull. To recap, the function it’s used to replace a string by using three paramaters : $stringToSearch, $stringToReplace, $intoString. I showed you how to use it in … Continue reading

Posted in Basic PHP | Tagged , , , , , , | Leave a comment

PHP Tutorial : Strpos and Strrpos

Basic thing, strpos and strrpos are two php functions which are used to find the position of first and/or last occurrence in a string – word (usefull for example when you want to build a function to get file extension). … Continue reading

Posted in Basic PHP | Tagged , , , , | 1 Comment

PHP Tutorial : String lenght with strlen

I’ll be directly on this short one. Shame on me that I didn’t writed about this untill now : there’s an interesting php function which you might need frequently called strlen() which translates into string lenght. I’m sure you met … Continue reading

Posted in Basic PHP | Tagged , , , , , | Leave a comment

PHP Tutorial : If condition in the short way (shorthand if)

Do you know basical php if() condition right? But, my questions is : do you know the short way? If not, I will show you the diferrence,: <?php $a=1; $b=3; $c = $a+$b; //THE SHORT WAY COMES print $c == … Continue reading

Posted in Basic PHP | Tagged , , , , , | 2 Comments

PHP Tutorial : PHP $_POST array

Hello folks, BTW Happy Easter,my traffic this weekend decreased dramatically because of the hollidays, I hope you enjoy it. I want to clarify something that I might missed to say about php $_POST : this $_POST is an php array, … Continue reading

Posted in Basic PHP | Tagged , , | 1 Comment

PHP Tutorial : Substract part of string with substr

Hello, I didn’t posted for a long time because I am simply stucked into finding a subject. I made a search into my own blog and I saw that (miraculous btw) I didn’t writed yet about substr function which helps … Continue reading

Posted in Basic PHP | Tagged , , , | Leave a comment

PHP Tutorial : Forms processing with $_POST or $_GET

Are you just curious to know the difference between $_GET and $_POST php server variables? Errrr, let me try and explain. I dont see many differences, or maybe I dont know/explain, but what I understand it is that $_POST it’s … Continue reading

Posted in Basic PHP | Tagged , , , , , , , , , , | Leave a comment

PHP Tutorial : Clear white spaces

Ever got extra white spaces and dont wanna clear them manually or just cannot? In PHP, we have a great function called trim(), which will do your job. If you made a .htaccess rewrite (most of the cases), or just … Continue reading

Posted in Basic PHP | Tagged , , , , , , , , | 2 Comments

PHP Tutorial : Lowercase characters

In a recent post I’ve been writed about converting string to uppercase, now we need to know how to convert characters into lowercase. That will need strtolower() function which means string to lower. <?php $bigger = “This Is Big”; $lower … Continue reading

Posted in Basic PHP | Tagged , , | Leave a comment