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()
Related
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.
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:
PHP: Escape illegal chars in .ini-files
(2 answers)
Closed 1 year ago.
When using parse_ini_file, it will attempt to read and understand the ini file. I'm looking for a solution that will read the file, place it into arrays much like parse_ini_file does, however I don't want it to get to the special characters in my ini file and spit an error that it can't parse them. Could anyone point me in the right direction?
ini file for reference:
[IMPORT]
email=email#thisisanemail.com
location=
Description=Order Form
name=*.xls*
matrixfile=
matrix_field=
matrix_disc_type_column=
matrix_disc_percentage_column=
fixed=XLS
separator=|
RowTerminator=
headerrows=13
footerrows=0
maxexcelcolumns=7
If I parse this, it gets stuck on the seperator "|" but I need that there.
If you use parse_ini_file with the scanner_mode parameter to specify INI_SCANNER_RAW, then option values will not be parsed (see
https://www.php.net/manual/en/function.parse-ini-file.php).
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How remove extension from string (only real extension!)
Remove file extension on file upload
I am looking for ways to remove extensions but from what i found in google are really bad examples on how to do it.
$from = preg_replace('/\.[^.]+$/','',$from);
Something like this, any idea on how to do it?
Check out the basename function, which should do that for you. Note that it will also strip any folder names in the path.
This question already has answers here:
Closed 13 years ago.
Possible Duplicate:
What is the use of # symbol in php?
I like to know the purpose and meaning of # in php codes.
For instance, #umask or #ini_set. What's the difference without # and with #?
PHP's error suppress operator used to suppress error messages.
SideNote: Avoid it as much as you can, also it slows down performance heavily and not allowed to be used in ini_get and ini_set functions in future php versions.
"Swallow an error", continue despite an error occuring. An non-critical operation augmented with # will not abort script execution.
# symbol is an error control operator check out manual here