Answers for "php isarray"

PHP
4

php isarray

<?php
$yes = array('this', 'is', 'an array');

echo is_array($yes) ? 'Array' : 'not an Array';
echo "\n";

$no = 'this is a string';

echo is_array($no) ? 'Array' : 'not an Array';
?>
Posted by: Guest on April-12-2020
1

php variables as keys in arrays

$id = 1;
$age = 2;    
$sort = "id"; // or "age";
    $Key = $$sort;
$arr = array($Key => 'string');

print_r($arr);
Posted by: Guest on August-13-2020
0

is array php

$arr = 'This is not array only string';
 
if ( is_array($arr)) {    
    echo 'Available';
}
Posted by: Guest on September-25-2021

Browse Popular Code Answers by Language