Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php function to print array value by key

function kPrint($key,$obj){    
    return (gettype($obj)=="array"?(array_key_exists($key,$obj)?$obj[$key]:("<font color='red'>NA</font>")):(gettype($obj)=="object"?(property_exists($obj,$key)?$obj->$key:("<font color='red'>NA</font>")):("<font color='red'><font color='green'>:::Exception Start:::</font><br>Invalid Object/Array Passed at kPrint() Function!!<br> At : Variable => ".print_r($obj)."<br>Key => ".$key."<br> At File: <font color='blue'>".debug_backtrace()[0]['file']."</font><br> At Line : ".debug_backtrace()[0]['line']."<br><font color='green'>:::Exception End:::</font></font>")));
}

//call this function in echo and pass parameters like key and array/object
Comment

PREVIOUS NEXT
Code Example
Php :: import facade laravel 
Php :: $name = $name; "Robert" echo; 
Php :: php import 
Php :: razorpay refund laravel 
Php :: how to create php message 00 
Php :: visual studio php dollar sign double click 
Php :: livewire modal to datetime-local 
Php :: how to use php variable in javascript file 
Php :: example of valid php variables 
Php :: how to disable laravel cors 
Php :: set php variabe with javascript loca storage 
Php :: fix-wordpress-limit-permalink 
Php :: requires ext-pcntl 
Php :: costante php define 
Php :: get.krnl.key 
Php :: php store html in varible 
Php :: create newfilter wordpress 
Php :: Get Now Time In Persian Format JDF PHP Function 
Php :: convert php array into json online 
Php :: image_store 
Php :: HP officejet pro 8720 default password 
Php :: convert php to curl 
Php :: remove public/index.php from laravel url 
Php :: flask like framework for php 
Php :: file upload yii2 rest api 
Php :: join in php 
Php :: larevel binance api 
Php :: laravel list unique indexes 
Php :: laravel download file from storage with progress bar 
Php :: Convert backslash characters PHP 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =