Print array :)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
session
Forum Newbie
Posts: 5
Joined: Tue Feb 25, 2014 8:33 am

Print array :)

Post by session »

Simple as that, how i can print out the values into a index.php page. I have autoloadclass for loading classes.

Code: Select all

<?php
class init{

 public function __construct(){
		$array = array(
		 
			'session' => array
			(
				'session_id' => '',
				'session_name' => '',
			),
			'cookie' => array
			(
				'cookie_id' => '',
				'cookie_name' => '',
			),
			'mysql' => array
			(
				'host' => ' ',
				'username' => ' ',
				'password' => ' ',
				'database' => ' ',
			)
		);
		return $array;
	}
}
?>
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Print array :)

Post by Celauran »

Constructors don't return values, they instantiate the class. What are you trying to do?
session
Forum Newbie
Posts: 5
Joined: Tue Feb 25, 2014 8:33 am

Re: Print array :)

Post by session »

Just to print multidimensional array from class file.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Print array :)

Post by pickle »

print_r() or var_dump()
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply