Best PHP IDE’s Windows/Linux and Mac OS

Sublime Text 3

The lightweight and very popular text editor supports a lot of programming languages. You can use a free version or buy a license for 80$. I think it’s a must to have editor and successfully replacing Notapad++. Responsiveness and speed is a very big advantage when you have limited ram/cpu. If out of box functionality is not for enough you can search and install packages

Visual Code
Created by Microsoft, Open Source free IDE, VS Code supports many programming languages and is lightweight enough to work on slow computers. It’s one of the best editors for JavaScript/Typescript but you will need to install extension to make it work well with PHP.

Netbeans
Created by Apache Software Foundation it’s free and open-sourced. Great out of box PHP support, greate autocomplete function, for professional PHP programmer it should be great IDE but uses a lot of resources, it can be slow and not very responsive on a slow computer.

PHPStorm
Costs 199$ the first year and also have free trails for 30 days. Considered as BEST PHP ide! It’s heavier then VS Code & sublime but it’s much more powerful than any other in this list. No matter on which PHP project you work, it feels like Phpstorm just understands your project and helping you to do things much faster. The only downside is price but if you can afford it, it’s best.

PHP Script To Send Email Using SMTP

It’s very easy to send email using PHP via SMTP, first of all you must downloads PHP Mailer (https://github.com/PHPMailer/PHPMailer), after we will use small script as an example which will connect to smtp and send email.

<?php
 
require_once "PHPMailer-master/PHPMailerAutoload.php";
 
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = "mail.domain.com";
$mail->SMTPAuth = true;
$mail->Username = "username";
$mail->Password = "password";
$mail->From = "[email protected]";
$mail->FromName = "Your Name";
$mail->AddAddress("[email protected]");
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = "This is subject";
$mail->Body = "THis is body <b>html</b>";
$mail->AltBody = "This is the body in plain text.";
if (!$mail->Send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    echo "Message sent!";
}

MySQL fetching the first row instead of all

This problem normally occurs when your forgetting to place array into container, for example PHP

$query = mysql_query( "SELECT * FROM `table`" );
$getrows = mysql_fetch_assoc( $query );
 
foreach ( $getrows as $row ) {
echo $row['id'];
}

We will have in this situation only first row not others, to get all rows we must use while() loop PHP

$query = $db->query( "SELECT * FROM `matches`" );
while ( $rows = mysql_fetch_array( $query ) ) {
echo rows['id'];
}

using while loop your getting all rows you can save them into array and so on.