php


Variable class call and namespace in PHP


Using a variable containing the name of a class then creating a new instance of that class, I have a question on the way I call the class in the variable.
My code works:
use AppBundle\Entity\someEntity;
$entityName = "AppBundle\Entity\someEntity";
$instance = new $entityName();
Now, what I would like to do is change the $entityName variable for something more simple like $entityName="someEntity";
Anyone have any idea on how to do that?
I am using PHP5.5
Thanks

Related Links

Custom Post Taxonomies List
error 7#7: *1 upstream prematurely closed connection while reading response header from upstream
PHP taking user input and formatting output (dates)
how to get the date for promotion from mysql using php / dynamic price
page/2/ Error 404 not custom query
Auto one-to-one model in Laravel
Warning: PHP Startup: Unable to load dynamic library apc.so
Schema describes boolean, string found instead when I create list through Mailchimp API
Braintree PHP SDK cURL exception
Shortcut for echo “<pre>”;print_r($myarray) inside foreach laravel
load default page from sub folder index page using .htaccess php
Parse error: syntax error, unexpected '"', expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) [duplicate]
How to remove items with certain length from array in php
PHP running multiple scripts concurrently
Laravel can't grab inputs from form to send out email
Find array key where value contains a specific value

Categories

HOME
python-2.7
nam
mod-rewrite
facebook-messenger
concurrency
kivy
hdfs
theano
jersey-2.0
header
iptables
tibco
hyperledger
log4j2
game-maker
fullcalendar-scheduler
angular4
asp.net-core-1.0
async-await
word2vec
exchange-server-2010
backendless
msdeploy
sfml
nic
python-2.x
om-next
polyml
db2-luw
jfxtras
nppexec
unification
iscroll
assert
nomad
adblock
rightnow-crm
sonarqube5.2
cloudwatch
icecast
comm
webvtt
nivo-slider
portability
dblink
hmmlearn
http4s
wildfly-9
email-injection
yargs
visual-studio-monaco
jtag
powerpoint-2013
odp.net-managed
jsr363
ioexception
webgrind
juniper-network-connect
ibm-was
largenumber
ruby-on-rails-4.1
dsa
gitlab-omnibus
relational-model
erlog
zend-mail
squeezebox
two.js
forceclose
rails-api
sqlbindparameter
wso2bam
hotswap
disjoint-union
lru
2d-vector
office-app
towers-of-hanoi
instance-variables
websphere-6.1
fitch-proofs
litespeed
vows
sql-parametrized-query
airprint
webresponse
firephp
subtext
eai
xap
downloadfile

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App