tags:

views:

31

answers:

1

I am setting up a template system, Long story short: I need/want to check if a variable with the name of a tag has been set. the tag name is in another variable.

Therefore, I need to check to see if the content of $tag (i.e. title) has a variable with the same name ($title).

Any help is appreciated. Thanks.

+4  A: 

Use variable variables:

<?php

$tag = 'title';

// bool(false)
var_dump(isset($$tag));

$title = 'this is the title';

// bool(true)
var_dump(isset($$tag));
meagar
WOOT Thank you!