Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x
Author Message
hicuxunicorniobestbuildpc
The Mouse Is Extension Of Arm



Joined: Aug 13, 2009
Posts: 1055

PostPosted: Fri Nov 27, 2020 7:31 am Reply with quote

Hello to everyone...

I am getting new errors I've never seen before with php 7.1

Notice: Undefined variable: op in /www.bestbuildpc.org/modules/Media/index.php on line 122

Line 122 is:

Code:
case 'music1':



Function is:

Code:
switch($op) {


    default:
   mainpage1();
   break;
   
   case 'music1':
   music1();
   break;

}



This function means page will switch to when u click on Music buttom but now OP is underfined.

I was trying to understand some examples from here.
[ Only registered users can see links on this board! Get registered or login! ]

Code:


<?php

$string="2string";

switch($string)
{
    case (string) 1:
        echo "this is 1";
        break;
    case (string) 2:
        echo "this is 2";
        break;
    case '2string':
        echo "this is a string";
        break;
}

?>


Well, I just did this to fix the error and it is gone.

Code:
$op='music1';

switch($op) {

    default:
   mainpage1();
   break;
   
   case 'music1':
   music1();
   break;

}


P.S If someone can explain better and tell me why is this happening it will be nice to understand.
 
View user's profile Send private message
neralex
Site Admin



Joined: Aug 22, 2007
Posts: 1673

PostPosted: Fri Nov 27, 2020 8:52 am Reply with quote

The variable $op should be defined but not filled, otherwise it doesn't work correcty while passing the function with other op-parameters.

php Code:
if (!isset($op)) $op = '';


switch($op) {

default:
mainpage1();
break;

case 'music1':
music1();
break;

}

_________________
Github: RavenNuke 
View user's profile Send private message
hicuxunicorniobestbuildpc







PostPosted: Fri Nov 27, 2020 8:59 pm Reply with quote

Thanks for the explanation. This issue is fixed.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©