I have no idea what I'm looking at. Can someone pop the hood on this for me and tell me what this is?

Take a look at the code below:

require '../common/common.php';
@$level = 'Region';
@$market = 'South Regions';
@$type = 'Stacked';

@$kpi1 = 'rrc_setup_failure_pcnt';
@$kpi2 = 'bearer_drop_pcnt';

@$mkt2 =  $_GET['mkt'];
@$mktid = substr($mkt,0,3);
@$kpi1c = $_GET['kpi1c'];
@$kpi2c = $_GET['kpi2c'];
@$profile = $_GET['profile'];
//echo 'Level: '.$level.' Market: ' . $market.' Type: '.$type.' KPI1: '.$kpi1.' KPI2: '.$kpi2;

if ($market == '' && $mkt2 <> ''){ $market = $mkt2;}



if ($kpi1c == '') {
$my_array = array('#0000ff','#0000ff','#006600','#0066cc','#9600ff','#0b6693','#f0145a','#1c5252','#ad3d3d','#2de50e');
shuffle($my_array);
$kpi1c = $my_array[3];
$c1= substr($kpi1c,1,6);
//echo ' kpi1c ' . $kpi1c . '<br>';
}
else {@$kpi1c = '#'. $_GET['kpi1c'];$c1= substr($kpi1c,1,6);}

if ($kpi2c == '') {
$my_array = array('#0000ff','#0000ff','#006600','#0066cc','#9600ff','#0b6693','#f0145a','#1c5252','#ad3d3d','#2de50e');
shuffle($my_array);
$kpi2c = $my_array[7];
$c2= substr($kpi2c,1,6);
//echo ' kpi2c ' . $kpi2c . '<br>';
}
else {$kpi2c = '#'. $_GET['kpi2c'];$c2= substr($kpi2c,1,6);}

Open in new window


First thing: what is "@$level='Region'"? Not to sound like one who is totally clueless, but what's the significance of the "@" sign?

The rest is, from what I can tell, some design data that's used with some Javascript charts later in the page. But I want to know what the "@" sign is. I've seen that with session variables, but I've never taken the time to pop the hood and understand what that is.

A little help...?
Bruce GustPHP DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
The @ sign is misused in this context.  It suppresses PHP messages, and is almost never used correctly.
http://php.net/manual/en/language.operators.errorcontrol.php

See also Antipractice #5:
http://www.experts-exchange.com/articles/12293/AntiPHPatterns-and-AntiPHPractices.html

This is a terribly badly written piece of code.  It looks very old, perhaps from PHP4 days?  Where did it come from?  Please refactor it, or make sure it is trustworthy before you use it in your application!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dave BaldwinFixer of ProblemsCommented:
I looked thru the PHP man pages and I could not find any other use for '@'.  And the only place I use it is in someone else's code.  I never use it in my own code.
Bruce GustPHP DeveloperAuthor Commented:
That was it! And Dave, I found myself using the "@" sign in the very way you described as far as circumventing a potential disconnect because of the way the previous developer had structured things.

Thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.