Skip to content

Instantly share code, notes, and snippets.

View neloy-ahmed's full-sized avatar

neloy-ahmed

View GitHub Profile
<?php
abstract class World{
//Abstract class can contain variable
public $var1 = 'hello ' . 'world';
//Abstract class can also contain constant
const b = 'i\'m a constant';
<?php
interface World
{
public function draw_flag();
}
interface Animal
{
public function sounds();
}
@neloy-ahmed
neloy-ahmed / instanceof.php
Last active January 29, 2019 09:52
PHP interesting code
<?php
//Instanceof will return boolean if the object is an instance of a class
class Tome {
}
$k = new Tome();
{
"code": 200,
"status": "success",
"message": "Data successfully retrieved",
"data": {
"doctors": [
{
"id": 2,
"dr_type": "Specialists",
"name": "Dr. Mostafa Kamal",
$speciality = $_POST['speciality'] ?? '';
$name = $_POST['name'] ?? '';
$hospital_id = $_POST['hospital_id'] ?? '';
$experience = $_POST['experience'] ?? ''; //query will be greter than or equal to $experience
$fees = $_POST['fees'] ?? '';//query will be less than or equal to $fees
$conn = new PDO('DB connection string here');
$search_conditions = '';
$search_conditions .= !empty($name) ? " AND name LIKE % $conn->quote($name) % " : '';
{
"code": 500,
"status": "error",
"message": "Something Went Wrong",
}
{
"code": 200,
"status": "success",
"message": "Data successfully retrieved",
"data": {
"doctors": []
}
}