what does this mean: " * "

Hi there, Im’m try to make sense of this search filter and I don’t know what this symbol means: *
Does it mean something in PHP or is it an operator that means something to the sql database?

This is the context:

$where_filter = " “;
foreach($search_map as $search_name)
$where_filter .=” $op $search_name $not REGEXP ‘$where’";

$where_filter = substr($where_filter, 5);

if($where != "*"){
    $where_filter .= "and product_type!='3'";
    $q->addWhere("($where_filter)");
}
else{
    $q->addWhere(" product_type!='3'");
}

In PHP, besides being the multiply operator, * has no real special meaning, outside of a few functions and formats.

In MYSQL, you can use it as part of a SELECT statement to select all columns in a table for a result set that matcehs a specific query.

In regular expressions it is known as the “0 or more” operator, allowing the sub pattern attached to the operator to match in a string where it occurs zero times or more.

Beyond these three things, I’m not sure what else it would be. I have no clue what the point of it is in your script, as I don’t know the context behind that snippet

Thanks, I’m having a hard time figuring out what it means because I can’t search for * in Netbeans IDE since that symbol actually means something else to the Netbeans

It’s wrapped in quotes, so it’s being treated as a string. Therefore PHP has nothing to do with it. It is simply checking whether or not someone has put the * symbol in the search box (as an assumption). It is not an operator in this context, purely a string/value.

I talked to the person that worked with my code before me and they informed me this * is a regular expression or regex.

Sponsor our Newsletter | Privacy Policy | Terms of Service