Jump to content

[SOLVED] General questions about PHP?


samoi

Recommended Posts

Hello guys, sorry for bothering!

 

I have some questions about PHP!

 

 

Now so many times I see something like!


<?php

@preg_replace($pat, $rep, $str); // what does the *@* [AT] sign means in front of the function or include function?


// also sometimes I see the question mark! *?*

$question_mark = $samoi ? 0:1 // I don't know if this syntax is correct, but I want to explain where I usually see it!



?>

 

 

 

Thank you.

Link to comment
https://forums.phpfreaks.com/topic/178766-solved-general-questions-about-php/
Share on other sites

@ operator

 

good explanation here ..

http://thesmithfam.org/blog/2006/05/07/php-the-operator/

 

 

single line if statement

$question_mark = $samoi == 'Yes'  ? 0 : 1;

//is the same as 

if($samoi == 'Yes'){
    $question_mark = 0;
}else{
     $question_mark = 1;
}

 

Hope that helps.

 

 

 

The ampersand suppresses error messages for that particular line.

 

Unless that is some alternate method I've never heard of I don't think you meant ampersand which is & and is used for signalling byRef variables. I'm sure Maq is aware of that, but thought I'd point it out for anybody else who reads the thread like me and becomes a little puzzled.

The ampersand suppresses error messages for that particular line.

 

Unless that is some alternate method I've never heard of I don't think you meant ampersand which is & and is used for signalling byRef variables. I'm sure Maq is aware of that, but thought I'd point it out for anybody else who reads the thread like me and becomes a little puzzled.

 

Oops, yeah good catch.  I meant '@' not '&'.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.