php filter with get variables [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I suck at regexp but i'd like to just do a simple filter where / is replaced with 1, " is replaced with 2 and < is replaced with 3.
I'd appreciate an example where the syntax would be straight forward, i'd like to run this filter through the input of a get variable provided by the user. A syntax like:
replace(/,1)
replace(",2)
replace(<,3)
.
Thanks.

I really don't see the need for regex here.. You can just use str_replace
E.g.
str_replace('/', '1', $_GET['var']);

Related

Understanding - "$result = imap_fetch_overview($mbox,"1:{$check->Nmsgs}",0);" [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am tring to learn about the imap function, and I am struggling to understand:
$result = imap_fetch_overview($mbox,"1:{$check->Nmsgs}",0);
In particular $mbox,"1:{$check->Nmsgs}",0
PHP manual says it uses the X:Y syntax.
But I just cant get my head around it.
Please can anyone assist.
This is explained in the docs, which you should definitely start reading now:
When a string is specified in double quotes or with heredoc, variables
are parsed within it.
And follow this link: http://php.net/manual/en/language.types.string.php#language.types.string.parsing

Regex to select everything in between two characters [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to create a regex that will select the data between two characters (& - #).
& foo #
I would like to select foo.
Any ideas? Good explanations are also appreciated.
how about this:
preg_match('~&([^#]*)#~',$content,$match);

mongo:db.users.find({"addressse.0.state":"NY"}) write in php? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
In learing mongo with php,I have a tiny problem,
that is all,any help would be great appreciated!
You need to read this MongoPHPQueries Page and probably before that you need to do as #RocketHazmat said and start with this MongoPHP Tutorial.
But here is something that might help you with the data you are trying to find.
$cursor = $collection->find(array("addressse.0.state" => "NY"));
The above will give you a cursor allowing you to iterate over each record that is returned. Hope this helps.
FYI - You need more than just that line above to get that to work. So follow the links.

Numbers of characters in a PHP variable? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
OK there is an input field for visitor to enter something in it (like nickname lets say). I wish for (upcoming $_POST) variable to have at least (at least) 4 characters before starts to trigger function.
Here is some cosmetic example..
$inputdata = escapeHTML($_REQUEST['data']);
if($inputdata...)
{
//execute $inputdata
}
Any cool trick? Thx!
if (strlen($inputdata) >= 4)
This should work then
Or
if (mb_strlen($inputdata) >= 4) for non-latin text
Resources:
http://www.php.net/manual/en/function.mb-strlen.php
http://php.net/manual/en/function.strlen.php

Use this php code wih WHERE [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Can I use this php code wih WHERE? SELECT SUM(buzz) as buzz FROM $table I want to calculate sumation of some spesific rows.
If you want specifically in PHP then this might help you
SELECT SUM(buzz) as buzz FROM $table WHERE $where
No, you can't use PHP code in an SQL where condition. Databases typically don't include a PHP interpreter.
What you can do is use PHP to generate the where clause that you need.

Categories