Jump to content

Recommended Posts

Hi,

 

I have got a variable called $string. It holds a string value that is dynamically created on the form requirements. For this example lets just say it holds 'username == test && password == test' as a string.

 

What i want to do is being able to test to see if the $string variable string value returns true not the variable itself as that will always return true as it will always be set containing at least some content. So..

 

  $string = 'username == test && password == test';

 

  if($string){  //test for variable string content not to see if $string has been set

 

  }

 

I hope i have made this clear enough and one of you guys out there will be able to help.

 

Thanks in advance

 

jug

 

 

 

 

Thanks for your reply. No that is not what i want as isset() just checks to see if the variable is set and in this case it will always be set as there will always be something in the string variable.

 

What i need is to test the $string content as a string (almost like echo-ing it in to the if statement itself).

Hey, my first post on phpfreaks.com  ;D

 

I think what you're searching for is:

 

$username = 'tedst';
$password = 'test';
$string = ($username == 'test' && $password == 'test');

  if($string == true){  //test for variable string content not to see if $string has been set
echo ('true');
  } else {
  	echo ('false');
  }

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.