Basic PHP if logic for multiple statements -
i want include addtohomescreen.php
in page following conditions:
$ua !== 'sattamatka.pro'
-> true$ua !== 'sattamatka.android'
-> truestripos($ua,'android') == true)
-> true
i using following logic:
<?php if($ua !== 'sattamatka.pro' || $ua !== 'sattamatka.android' && stripos($ua,'android') == true) { include "addtohomescreen.php"; } ?>
note: want of them true. if use &&
in place of ||
both of statements - $ua !== 'sattamatka.pro'
, $ua !== 'sattamatka.android'
becomes false , addtohomescreen.php
included in both $ua
.
edit: possible vales of $ua
are:
sattamatka.pro
sattamatka.android
mozilla/5.0 (linux; u; android 6.0.1; en-us; redmi note 3 build/mmb29m) applewebkit/534.30 (khtml, gecko) version/4.0 ucbrowser/11.2.5.932 u3/0.8.0 mobile safari/534.30
update: problem $ua = 'sattamatka.pro'
, $ua = 'sattamatka.android'
statement if(($ua !== 'sattamatka.pro') && ($ua !== 'sattamatka.android') && (stripos($ua,'android') == true))
returned false. has been solved adding ()
($ua !== 'sattamatka.pro') || ($ua !== 'sattamatka.android')
& code works expected. don't need more suggestions. thank time.
you need use &&
if want condition become true
if(($ua !== 'sattamatka.pro') && ($ua !== 'sattamatka.android') && (stripos($ua,'android') == true)) { include "addtohomescreen.php"; }
Comments
Post a Comment