-2

I have a problem with fixing undefined variable. I've also tried to use isset but it's not working.

Errors:

Warning: Illegal string offset 'dir'
Notice: Uninitialized string offset: 0
Warning: Illegal string offset 'dir'
Notice: Uninitialized string offset: 0

Code:

$page = ""; 
define("IN_SYSTEM", TRUE);

if(strpos($_SERVER['SERVER_SOFTWARE'],"Win") == false){ $page['dir'] = 
str_replace('\\','/',$page['dir']); }
chdir(str_replace($page['dir'], "", getcwd()));
julienc
  • 19,087
  • 17
  • 82
  • 82

1 Answers1

2

You define $page as a String. Then you try to access an array key, that can not work. You never define $page as an array or fill the key "dir". What are you trying to do here?

CBergau
  • 636
  • 2
  • 10
  • 26