This may be a stupid question, but I need to know how to cast a variable in zf2.
$var = (string) $id ;
How ca I do it with this kind of type :
\MediaLayer\Argument\SelectMediaArguments
This doesn't work:
$arg = (\MediaLayer\Argument\SelectMediaArguments) $var
There is no need to type cast in php.
i could be wrong but ia, guesting that you want you IDE to recognize the $var az the selected class , in that case you need to use phpdoc block :
/* @var $var \MediaLayer\Argument\SelectMediaArguments */
$var = X;
if this is not what you want please be more clear because there is not object casting in php
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.