MHowey MHowey - 3 months ago 6
PHP Question

PHP Return in function Fedex

Dont know if I should add to this post or not but it is kind of relevant I think

This works just fine

function getProperty($var)
{
if($var == 'check')
Return true;

if($var == 'shipaccount')
Return '286096425543324';


But this does not? How would one enter a

$fedex_account = "286096425543324";
function getProperty($var)
{
if($var == 'check')
Return true;

if($var == 'shipaccount')
Return '$fedex_account';

Answer
'$fedex_account'

Single quotes don't expand variables. Just do this:

function getProperty($var){
// You need this if $fedex_account is a global variable
global $fedex_account;
if($var == 'check') Return true;
if($var == 'shipaccount') Return $fedex_account;
Comments