This question already has answers here:
Reference Guide: What does this symbol mean in PHP? (PHP Syntax)
(24 answers)
Closed 3 years ago.
My company has asked me to analyse backend code for one the live websites that our company maintains. I have run into a problem. I can't quite figure what '#' is doing here in this code if(#($_SESSION['user'])){...}
I looked everywhere what this means and haven't found anything even remotely resembling this. I hope someone on this forum can help me out. Below is the entire code snippet.
if(#($_SESSION['user']))
{
$usrid=$_SESSION['user'];
$getprflimg=$db->singlerec("select img from register where
id='$usrid'");
$imgurlprl=$getprflimg['img'];
if(file_exists($url))
$imgurlprl=$siteurl."uploads/user_images/".$imgurlprl;
else
$imgurlprl=$siteurl."/uploads/user_images/no_image.png";
}
# before the variable is used to suppress the warning generated for that variable. This is also relevant to 'At' symbol before variable name in PHP: #$_POST.
Related
This question already has answers here:
Reference - What does this error mean in PHP?
(38 answers)
Closed 2 years ago.
I have 2 php files inside joomla and I want to make a variable from php-file 1 available in php-file 2.
php-file_1.php
$a_variable = $input->getString('text');
php-file_2.php
include(php-file_1.php);
echo $a_variable;
I get Notice: Undefined variable: a_variable in /var/www/vhosts/a_domain.de/httpdocs/php-file_2.php on line 2
what's wrong here?
include and require are not functions, they are language constructs. Therefore they need to be used without brackets.
Either way, you missed quotes around php-file_1.php.
include 'php-file_1.php'; should work fine.
This question already has answers here:
How can I convert ereg expressions to preg in PHP?
(4 answers)
Closed 4 years ago.
I've read many threads here about this being deprecated and tried replacing it with preg_match but I don't know php enough to fix the rest of the line.
Been enjoying Fotoholder for years, I would switch to a newer similar single file gallery code but then I would lose all my descriptions in the gallery.
Please help resurrect Fotopholder!
( https://github.com/offsky/Fotopholder )
Here are the 2 parts that have eregi:
if(substr($entry,0,1)!="." && !preg_match("#_cache#i",$entry) && is_dir($path."/".$entry)) {
and the 2nd eregi:
if(substr($entry,0,1)!="." && !eregi("_cache",$entry)) {
Thank you very much for your help.
Deprecated means, that the function eregi() is likely to get deleted from the language.
Please use preg_match().
While you still can use eregi(), at a certain point of time your application might not be able to execute any more.
That said: Your code posted is far to big to get a detailed answer.
This question already has answers here:
Reference Guide: What does this symbol mean in PHP? (PHP Syntax)
(24 answers)
Closed 6 years ago.
$channel =<<<_XML_;
what is meaning of above statement ?
Is XML predefined variable ?
What is the meaning of <<<
This syntax is called a heredoc. It's very convenient to enter long (usually multiline) strings without having to mess around with escaping etc.
This question already has answers here:
Reference Guide: What does this symbol mean in PHP? (PHP Syntax)
(24 answers)
Closed 7 years ago.
I want to know about meaning of $$val; what is the actual meaning is?i tried to find meaning of this in google but not understand properly. Please help me in this situations.
For example: suppose i have one variable which has $$value;
meaning of $$value?
You didn't put the language, but I'll assume you mean PHP
That's a variable variable.
That means you ware asking for the value of the variable whose name.is the first variable.
Here's an example, since that's quite confusing:
$foo = "Hi";
$bar = "world";
$world = "Hello!";
echo $$bar; // "Hello!"
php fiddle: http://ideone.com/Ve4YOO
Reference: https://secure.php.net/manual/en/language.variables.variable.php
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Reference - What does this symbol mean in PHP?
Found an image upload script on the net and I'm just modifying it to my needs. It contains lines like the one below that begins with an # symbol. I'm more of a javascript/jQuery guy so can someone explain what this '#' syntax is all about please?
#move_uploaded_file($_FILES[$fieldname]['tmp_name'], $uploadFilename)
or error('receiving directory insuffiecient permission', $uploadForm);
Please note I'm not asking what the above lines do, just about the functionality of the # symbol
It stops error messages, see here:
http://us3.php.net/manual/en/language.operators.errorcontrol.php
It suppresses PHP errors, generally it'll be used by lazy developers as a substitute to isset()