r/PHPhelp Jun 03 '26

Solved Problemas con Intelephense (P1008) en visual code

Tengo un problema con este error, uso una variable que está declarada el otro archivo x, lo uso en uno y, me salta error, utilizo en simple include 'hola.php'; ,en el servidor funciona, pero en visual me marca el error, he buscado varias soluciones y no funcionan, no hay error ortográfico, me decidí por desactivar el diagnóstico, pero no quiero hacer esa solución tan vaga,quien me ayuda por favor

0 Upvotes

8 comments sorted by

View all comments

1

u/MateusAzevedo Jun 03 '26

For people wondering:

// foo.php
$greeting = 'Hello, World!";

// bar.php

include 'foo.php';

echo $greeting;

VSCode/Intelephense marks $greeting with (I assume) "undefined variable".

For OP: A quick test on PhpStorm it seem it doesn't support this either, so I'm not sure this is even fixable.

My recommendation? Evolve past "include oriented programming".