Jump to content

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 '&'.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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