CodeWithSushil
CodeWithSushil

Sushil Kumar

@CodeWithSushil

Full Stack Web Developer (LAMP / TALL), PHP, Laravel, Bootstrap, jQuery, Git & GitHub, and Firebase / Supabase

15 Posts 256 Views

/ 255

What is difference between facebook's hack lang and PHP after PHP 8.1 ?

PHP is dynamic language.

Hack lang is modified language of php and type checking is required and other hand php have type checking is optional.

PHP:
<?php
echo "Hello 👋 World !!!";
?>

Hack:
<?hh
echo " Hello 👋 Hack-Lang!!!";
?>

541

How to get user IP Address in PHP ?

function getUserIpAddr(){
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
// Check if from shared internet
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
// Check if from a proxy
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
// Default, REMOTE_ADDR
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}

$user_ip = getUserIpAddr();
echo 'User IP Address: '.$user_ip;

1

151

HTML code here:

<input class="search" type="search" id="search" name="s" placeholder="Search here..." required />

CSS code here:
.search {
border: 1px solid #2288FF;
}

JavaScript Code here:
const search = document.getElementById("search");

PHP code here:
$search = $_GET['s'];

SQL code here:
SELECT * FROM users WHERE users.id=1;

119