FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » detection of 2d array?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: detection of 2d array? [message #183656 is a reply to message #183647] Wed, 06 November 2013 22:04 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 11/6/2013 8:24 AM, Struchkov Vladimir wrote:
> I write short test for 2d dimension
>
>
> $a=array(1,2,3,4=>array(3,4,5,7=>array(1)));
> if (preg_match('/;a:[0-9]+:{/',serialize($a)))
> {
> echo 'I have more than one dimensions';
> }
> else
> {
> echo 'I have one demension';
> }
>

He was asking if a certain element of the first array is an array or
not; that's what is_array() is for.

J.O. has the best answer.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: detecting a file in use
Next Topic: Mysqli or PDO Persistent prepared statements
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 00:36:58 GMT 2024

Total time taken to generate the page: 0.04110 seconds