PHP constructor does not identify variable value

Asked

Viewed 42 times

0

Could someone tell me why in "Parent::__Construct('$bill');", if I put a variable there it does not identify it? I tried anyway, it only works if I type the name of the table, this $account comes from identify, already put echo $account before "Parent::__Construct('$account');"

<?php 
require_once('usuarios.v.php');
include 'identifica.php';

class User extends Usuarios{
public function __construct(){
echo $conta;
parent::__construct('$conta');
}
}

and he takes the name of the regular table, but when I put it in there he identifies it. Someone can help me?

<?php 
require_once('usuarios.v.php');
include 'identifica.php';

class User extends Usuarios{
   public function __construct(){
    parent::__construct('$conta');
}
}
  • Take the simple quotes because you’ll understand like a String, test there and tell me.

  • I’ve tried it like this, with doubles, single, without and msm so n works

  • If I give an echo $account; before the Parent line, it prints normal, but if it is a dps line it also identifies.

  • Place the user class

  • SOLVED - did I do that? php require_once('usuarios.v.php'); class User extends Usuarios{ public Function __Construct($account){ include 'identifies.php'; Parent::__Construct($account); } ;}

  • I put include inside Function and passed the variable through Construct

Show 1 more comment

1 answer

0


RESOLVED ->

<?php 
require_once('usuarios.v.php');

class User extends Usuarios{
 public function __construct($conta){
include 'identifica.php';
parent::__construct($conta);
}
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.